enhanced check when reading BMP file.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8859 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2009-07-10 05:03:24 +00:00
parent d405baa0b6
commit d2eec31912
1 changed files with 9 additions and 8 deletions

View File

@ -629,14 +629,15 @@ ConvertBmpToGopBlt (
// //
// Calculate the BltBuffer needed size. // Calculate the BltBuffer needed size.
// //
BltBufferSize = BmpHeader->PixelWidth * BmpHeader->PixelHeight * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL); BltBufferSize = MultU64x32 ((UINT64) BmpHeader->PixelWidth, BmpHeader->PixelHeight);
if (BltBufferSize >= SIZE_4GB) { //
// // Ensure the BltBufferSize * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) doesn't overflow
// If the BMP resolution is too large //
// if (BltBufferSize > DivU64x32 ((UINTN) ~0, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
BltBufferSize = MultU64x32 (BltBufferSize, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
IsAllocated = FALSE; IsAllocated = FALSE;
if (*GopBlt == NULL) { if (*GopBlt == NULL) {
// //