From: Hao Wu <hao.a.wu@intel.com>
To: edk2-devel@lists.01.org
Cc: Hao Wu <hao.a.wu@intel.com>, Jiewen Yao <jiewen.yao@intel.com>
Subject: [PATCH 4/5] MdeModulePkg/EbcDebugger: Add ASSERT to ensure FieldBuffer is not NULL
Date: Thu, 24 Nov 2016 10:56:34 +0800 [thread overview]
Message-ID: <1479956195-10764-5-git-send-email-hao.a.wu@intel.com> (raw)
In-Reply-To: <1479956195-10764-1-git-send-email-hao.a.wu@intel.com>
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>
---
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
next prev parent reply other threads:[~2016-11-24 2:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-24 2:56 [PATCH 0/5] Code refinements in MdeModulePkg/EbcDebugger Hao Wu
2016-11-24 2:56 ` [PATCH 1/5] MdeModulePkg/EbcDebugger: Operands of same size for bitwise operation Hao Wu
2016-11-24 2:56 ` [PATCH 2/5] MdeModulePkg/EbcDebugger: Add check for invalid 'CommandArg' Hao Wu
2016-11-24 2:56 ` [PATCH 3/5] MdeModulePkg/EbcDebugger: Add missing check for symbol not found Hao Wu
2016-11-24 2:56 ` Hao Wu [this message]
2016-11-24 2:56 ` [PATCH 5/5] MdeModulePkg/EbcDebugger: Compare ASCII char with '\0' Hao Wu
2016-11-24 3:12 ` [PATCH 0/5] Code refinements in MdeModulePkg/EbcDebugger Yao, Jiewen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1479956195-10764-5-git-send-email-hao.a.wu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox