From 1aed3a3e3659c4d5800462131784933e8d79f52f Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Thu, 21 Feb 2019 19:50:02 -0600 Subject: [PATCH] BmpSupportLib: fix BMP validation BMP files by tools other than MS paint can have a variable number of padding bytes, which results in the DataSize being less than (ImageSize - HeaderSize). Fix the check to be less stringent. Test: use BMP created by/saved by Photoshop Signed-off-by: Matt DeVillier --- MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c index c5e885d7a6..42e58ee731 100644 --- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c +++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c @@ -216,7 +216,7 @@ TranslateBmpToGopBlt ( if ((BmpHeader->Size != BmpImageSize) || (BmpHeader->Size < BmpHeader->ImageOffset) || - (BmpHeader->Size - BmpHeader->ImageOffset != DataSize)) + (BmpHeader->Size - BmpHeader->ImageOffset < DataSize)) { DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: invalid BmpImage... \n")); DEBUG ((DEBUG_ERROR, " BmpHeader->Size: 0x%x\n", BmpHeader->Size));