summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c')
-rw-r--r--MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
index 2c23e2c61c..6196262d14 100644
--- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
+++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
@@ -148,6 +148,11 @@ TranslateBmpToGopBlt (
return RETURN_UNSUPPORTED;
}
+ if ((BmpHeader->PixelHeight == 0) || (BmpHeader->PixelWidth == 0)) {
+ DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpHeader->PixelHeight or BmpHeader->PixelWidth is 0.\n"));
+ return RETURN_UNSUPPORTED;
+ }
+
//
// Only support BITMAPINFOHEADER format.
// BITMAPFILEHEADER + BITMAPINFOHEADER = BMP_IMAGE_HEADER
@@ -484,6 +489,10 @@ TranslateGopBltToBmp (
return RETURN_INVALID_PARAMETER;
}
+ if ((PixelHeight == 0) || (PixelWidth == 0)) {
+ return RETURN_UNSUPPORTED;
+ }
+
//
// Allocate memory for BMP file.
//