From 31a4e13c19c31e5f6ad1a927fb53b77e50d17661 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 6196262d14..963cb4fb04 100644 --- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c +++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c @@ -230,7 +230,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));