K8: Add in ASSERT to detect possible NULL pointer dereference.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7462 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2009-02-06 06:34:43 +00:00
parent fd0d484170
commit c410589ef1
1 changed files with 6 additions and 1 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Parser for IFR binary encoding. Parser for IFR binary encoding.
Copyright (c) 2007 - 2008, Intel Corporation Copyright (c) 2007 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -852,6 +852,7 @@ ParseOpCodes (
CurrentDefault = NULL; CurrentDefault = NULL;
CurrentOption = NULL; CurrentOption = NULL;
OptionSuppressExpression = NULL; OptionSuppressExpression = NULL;
ImageId = NULL;
// //
// Get the number of Statements and Expressions // Get the number of Statements and Expressions
@ -1063,6 +1064,8 @@ ParseOpCodes (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
ASSERT (CurrentExpression != NULL);
if (CurrentExpression->Result.Type != EFI_IFR_TYPE_BOOLEAN) { if (CurrentExpression->Result.Type != EFI_IFR_TYPE_BOOLEAN) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1604,6 +1607,7 @@ ParseOpCodes (
break; break;
} }
ASSERT (ImageId != NULL);
CopyMem (ImageId, &((EFI_IFR_IMAGE *) OpCodeData)->Id, sizeof (EFI_IMAGE_ID)); CopyMem (ImageId, &((EFI_IFR_IMAGE *) OpCodeData)->Id, sizeof (EFI_IMAGE_ID));
break; break;
@ -1611,6 +1615,7 @@ ParseOpCodes (
// Refresh // Refresh
// //
case EFI_IFR_REFRESH_OP: case EFI_IFR_REFRESH_OP:
ASSERT (CurrentStatement != NULL);
CurrentStatement->RefreshInterval = ((EFI_IFR_REFRESH *) OpCodeData)->RefreshInterval; CurrentStatement->RefreshInterval = ((EFI_IFR_REFRESH *) OpCodeData)->RefreshInterval;
break; break;