From 523f48e771b1088c6e2cfddc5c56cde1ef9a2ab0 Mon Sep 17 00:00:00 2001 From: Eric Dong Date: Thu, 26 Jun 2014 03:24:25 +0000 Subject: Refine code to make it more safely. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong Reviewed-by: Feng Tian git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15598 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c | 1 + MdeModulePkg/Universal/HiiDatabaseDxe/Database.c | 4 +++- MdeModulePkg/Universal/HiiDatabaseDxe/Font.c | 9 ++++++++- MdeModulePkg/Universal/HiiDatabaseDxe/Image.c | 4 +++- 4 files changed, 15 insertions(+), 3 deletions(-) (limited to 'MdeModulePkg/Universal/HiiDatabaseDxe') diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c index 0011c53e6f..f5e054d265 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c @@ -4339,6 +4339,7 @@ HiiConfigRoutingRouteConfig ( ); } if (EFI_ERROR (Status)) { + ASSERT (AccessProgress != NULL); // // AccessProgress indicates the parsing progress on . // Map it to the progress on then return it. diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c index 65334ded5e..01d7f02234 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c @@ -1,7 +1,7 @@ /** @file Implementation for EFI_HII_DATABASE_PROTOCOL. -Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2014, 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 @@ -2419,6 +2419,7 @@ AddPackages ( // StringPkgIsAdd = FALSE; FontPackage = NULL; + StringPackage = NULL; // // Process the package list header @@ -2505,6 +2506,7 @@ AddPackages ( if (EFI_ERROR (Status)) { return Status; } + ASSERT (StringPackage != NULL); Status = InvokeRegisteredFunction ( Private, NotifyType, diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c index 24bb502996..eef31d5bb8 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c @@ -2,7 +2,7 @@ Implementation for EFI_HII_FONT_PROTOCOL. -Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2014, 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 @@ -1040,8 +1040,12 @@ IsSystemFontInfo ( return TRUE; } + SystemDefault = NULL; + DefaultLen = 0; + Status = GetSystemFont (Private, &SystemDefault, &DefaultLen); ASSERT_EFI_ERROR (Status); + ASSERT ((SystemDefault != NULL) && (DefaultLen != 0)); // // Record the system default info. @@ -1687,6 +1691,7 @@ HiiStringToImage ( SysFontFlag = IsSystemFontInfo (Private, (EFI_FONT_DISPLAY_INFO *) StringInfo, &SystemDefault, NULL); if (SysFontFlag) { + ASSERT (SystemDefault != NULL); FontInfo = NULL; Height = SystemDefault->FontInfo.FontSize; BaseLine = SystemDefault->FontInfo.FontSize; @@ -2580,6 +2585,7 @@ HiiGetGlyph ( Foreground = StringInfoOut->ForegroundColor; Background = StringInfoOut->BackgroundColor; } else { + ASSERT (SystemDefault != NULL); Foreground = SystemDefault->ForegroundColor; Background = SystemDefault->BackgroundColor; } @@ -2723,6 +2729,7 @@ HiiGetFontInfo ( return EFI_INVALID_PARAMETER; } + StringInfoOutLen = 0; FontInfo = NULL; SystemDefault = NULL; LocalFontHandle = NULL; diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c index efa5bbb71b..ed0cf83c48 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c @@ -2,7 +2,7 @@ Implementation for EFI_HII_IMAGE_PROTOCOL. -Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2014, 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 @@ -1237,6 +1237,7 @@ HiiDrawImage ( return EFI_INVALID_PARAMETER; } + FontInfo = NULL; ImageIn = (EFI_IMAGE_INPUT *) Image; // @@ -1383,6 +1384,7 @@ HiiDrawImage ( FreePool (ImageOut); return Status; } + ASSERT (FontInfo != NULL); for (Index = 0; Index < Width * Height; Index++) { BltBuffer[Index] = FontInfo->BackgroundColor; } -- cgit v1.2.3