]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/EbcDebugger: Add ASSERT to ensure FieldBuffer is not NULL
authorHao Wu <hao.a.wu@intel.com>
Thu, 24 Nov 2016 02:43:33 +0000 (10:43 +0800)
committerHao Wu <hao.a.wu@intel.com>
Fri, 25 Nov 2016 05:34:24 +0000 (13:34 +0800)
In function EdbLoadCodBySymbolByIec(), AsciiStrGetNewTokenField() at line
1589 will return NULL if the first character in 'LineBuffer' is '\0'. But
the previous if statement at line 1576 ensures the above case will not
happen.

This commit adds ASSERT as warnings for the case that will not happen.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c

index 9573c43a9d5d4c890279351f54424915158b11c0..22a827d35de2d38f15f8942aa6bf0c2e219f2f8f 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-Copyright (c) 2007, Intel Corporation\r
+Copyright (c) 2007 - 2016, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -1587,6 +1587,7 @@ Returns:
       // get function name, function name is followed by char 0x09.\r
       //\r
       FieldBuffer = AsciiStrGetNewTokenField (LineBuffer, Char);\r
+      ASSERT (FieldBuffer != NULL);\r
       if (AsciiStriCmp (FieldBuffer, Name) == 0) {\r
         BufferStart = FieldBuffer;\r
         CodParseState = EdbEbcCodParseStateSymbolStart;\r