summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Library
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-07-10 05:03:24 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-07-10 05:03:24 +0000
commitd2eec3191275e0f799d42e179fc8d8a04290992f (patch)
tree8c793a747743d255e8739aabb11e0c2e846b2450 /IntelFrameworkModulePkg/Library
parentd405baa0b6566b08ec648f1fef1791c622c15b33 (diff)
downloadedk2-platforms-d2eec3191275e0f799d42e179fc8d8a04290992f.tar.xz
enhanced check when reading BMP file.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8859 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg/Library')
-rw-r--r--IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
index 012fe5be04..a352d80842 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
@@ -629,14 +629,15 @@ ConvertBmpToGopBlt (
//
// Calculate the BltBuffer needed size.
//
- BltBufferSize = BmpHeader->PixelWidth * BmpHeader->PixelHeight * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
- if (BltBufferSize >= SIZE_4GB) {
- //
- // If the BMP resolution is too large
- //
- return EFI_UNSUPPORTED;
- }
-
+ BltBufferSize = MultU64x32 ((UINT64) BmpHeader->PixelWidth, BmpHeader->PixelHeight);
+ //
+ // Ensure the BltBufferSize * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) doesn't overflow
+ //
+ if (BltBufferSize > DivU64x32 ((UINTN) ~0, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) {
+ return EFI_UNSUPPORTED;
+ }
+ BltBufferSize = MultU64x32 (BltBufferSize, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
+
IsAllocated = FALSE;
if (*GopBlt == NULL) {
//