From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2869781EEB for ; Wed, 23 Nov 2016 18:56:44 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 23 Nov 2016 18:56:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,689,1473145200"; d="scan'208";a="1089732618" Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.34]) by fmsmga002.fm.intel.com with ESMTP; 23 Nov 2016 18:56:42 -0800 From: Hao Wu To: edk2-devel@lists.01.org Cc: Hao Wu , Jiewen Yao Date: Thu, 24 Nov 2016 10:56:34 +0800 Message-Id: <1479956195-10764-5-git-send-email-hao.a.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.0 In-Reply-To: <1479956195-10764-1-git-send-email-hao.a.wu@intel.com> References: <1479956195-10764-1-git-send-email-hao.a.wu@intel.com> Subject: [PATCH 4/5] MdeModulePkg/EbcDebugger: Add ASSERT to ensure FieldBuffer is not NULL X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Nov 2016 02:56:44 -0000 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 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu --- MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c index 9573c43..22a827d 100644 --- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c +++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2007, Intel Corporation +Copyright (c) 2007 - 2016, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -1587,6 +1587,7 @@ Returns: // get function name, function name is followed by char 0x09. // FieldBuffer = AsciiStrGetNewTokenField (LineBuffer, Char); + ASSERT (FieldBuffer != NULL); if (AsciiStriCmp (FieldBuffer, Name) == 0) { BufferStart = FieldBuffer; CodParseState = EdbEbcCodParseStateSymbolStart; -- 1.9.5.msysgit.0