From: "wenyi,xie" <xiewenyi2@huawei.com>
To: <devel@edk2.groups.io>, <jian.j.wang@intel.com>,
<gaoliming@byosoft.com.cn>, <zhichao.gao@intel.com>,
<ray.ni@intel.com>
Cc: <songdongkuang@huawei.com>, <xiewenyi2@huawei.com>
Subject: [PATCH EDK2 v2 1/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue
Date: Fri, 16 Dec 2022 17:50:59 +0800 [thread overview]
Message-ID: <20221216095059.3088439-2-xiewenyi2@huawei.com> (raw)
In-Reply-To: <20221216095059.3088439-1-xiewenyi2@huawei.com>
When BitPerPixel is 1,4,8, there should be a color map in bmp file. But if
the format of bmp file is error, it maybe has no color map when BitPerPixel
is 1,4,8. The condition checking now can not catch this issue.
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
---
MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
index c5e885d7a6d5..1cdd857f48f8 100644
--- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
+++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
@@ -236,6 +236,12 @@ TranslateBmpToGopBlt (
return RETURN_UNSUPPORTED;
}
+ if ((BmpHeader->ImageOffset == sizeof (BMP_IMAGE_HEADER)) &&
+ ((BmpHeader->BitPerPixel & 0x0D) != 0))
+ {
+ return RETURN_UNSUPPORTED;
+ }
+
if (BmpHeader->ImageOffset > sizeof (BMP_IMAGE_HEADER)) {
switch (BmpHeader->BitPerPixel) {
case 1:
--
2.20.1.windows.1
next prev parent reply other threads:[~2022-12-16 9:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-16 9:50 [PATCH EDK2 v2 0/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue wenyi,xie
2022-12-16 9:50 ` wenyi,xie [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-08-18 2:26 wenyi,xie
2022-08-18 2:26 ` [PATCH EDK2 v2 1/1] " wenyi,xie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221216095059.3088439-2-xiewenyi2@huawei.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox