From 5cfe42344d342a082663d3fc221a3c1bb4e71e81 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Tue, 24 Apr 2012 01:59:55 +0000 Subject: [PATCH] Update HiiFont Service to return error status instead of ASSERT for the invalid input. Signed-off-by: Liming Gao Reviewed-by: Eric Dong git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13209 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Universal/HiiDatabaseDxe/Font.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c index 4d2fcc081b..66fc6b9781 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 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2012, 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 @@ -1819,7 +1819,13 @@ HiiStringToImage ( // Image = *Blt; BufferPtr = Image->Image.Bitmap + Image->Width * BltY + BltX; - ASSERT (Image->Height >= BltY); + if (Image->Height < BltY) { + // + // the top edge of the image should be in Image resolution scope. + // + Status = EFI_INVALID_PARAMETER; + goto Exit; + } MaxRowNum = (UINT16) ((Image->Height - BltY) / Height); if ((Image->Height - BltY) % Height != 0) { LastLineHeight = (Image->Height - BltY) % Height; -- 2.39.2