BMP file may has padding data between the bmp header section and the bmp data section, but current code logic not consider this case, so the check is not valid for some bmp file. Refine the logic for this case.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14142 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10 2013-02-21 05:48:37 +00:00
parent 6de4c35f99
commit b5ded3c4f0
1 changed files with 5 additions and 2 deletions

View File

@ -1,7 +1,7 @@
/** @file
BDS Lib functions which contain all the code to connect console device
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
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
@ -808,7 +808,10 @@ ConvertBmpToGopBlt (
ColorMapNum = 0;
break;
}
if (BmpHeader->ImageOffset - sizeof (BMP_IMAGE_HEADER) != sizeof (BMP_COLOR_MAP) * ColorMapNum) {
//
// BMP file may has padding data between the bmp header section and the bmp data section.
//
if (BmpHeader->ImageOffset - sizeof (BMP_IMAGE_HEADER) < sizeof (BMP_COLOR_MAP) * ColorMapNum) {
return EFI_INVALID_PARAMETER;
}
}