Matt DeVillier has uploaded this change for review. ( https://review.coreboot.org/c/edk2/+/58785 )
Change subject: BmpSupportLib: fix BMP validation ......................................................................
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 matt.devillier@gmail.com Change-Id: I97d2e90aef7043a28b3bdda2eab52cb19e086930 --- M MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/edk2 refs/changes/85/58785/1
diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c index 3ac31f6..944d01f 100644 --- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c +++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c @@ -213,7 +213,7 @@
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));