mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 15:44:04 +02:00
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:
parent
d405baa0b6
commit
d2eec31912
@ -629,13 +629,14 @@ 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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user