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>
This commit is contained in:
@ -230,7 +230,7 @@ TranslateBmpToGopBlt (
|
|||||||
|
|
||||||
if ((BmpHeader->Size != BmpImageSize) ||
|
if ((BmpHeader->Size != BmpImageSize) ||
|
||||||
(BmpHeader->Size < BmpHeader->ImageOffset) ||
|
(BmpHeader->Size < BmpHeader->ImageOffset) ||
|
||||||
(BmpHeader->Size - BmpHeader->ImageOffset != DataSize)) {
|
(BmpHeader->Size - BmpHeader->ImageOffset < DataSize)) {
|
||||||
|
|
||||||
DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: invalid BmpImage... \n"));
|
DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: invalid BmpImage... \n"));
|
||||||
DEBUG ((DEBUG_ERROR, " BmpHeader->Size: 0x%x\n", BmpHeader->Size));
|
DEBUG ((DEBUG_ERROR, " BmpHeader->Size: 0x%x\n", BmpHeader->Size));
|
||||||
|
Reference in New Issue
Block a user