public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH EDK2 v2 0/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue
@ 2022-08-18  2:26 wenyi,xie
  2022-08-18  2:26 ` [PATCH EDK2 v2 1/1] " wenyi,xie
  0 siblings, 1 reply; 4+ messages in thread
From: wenyi,xie @ 2022-08-18  2:26 UTC (permalink / raw)
  To: devel, jian.j.wang, gaoliming, zhichao.gao, ray.ni
  Cc: songdongkuang, xiewenyi2

Main Changes since v1 :
1.fix format issue found by Uncrustify 

Wenyi Xie (1):
  MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue

 MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c | 6 ++++++
 1 file changed, 6 insertions(+)

-- 
2.20.1.windows.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH EDK2 v2 1/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue
  2022-08-18  2:26 [PATCH EDK2 v2 0/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue wenyi,xie
@ 2022-08-18  2:26 ` wenyi,xie
  2022-08-18  4:23   ` [edk2-devel] " Sean
  0 siblings, 1 reply; 4+ messages in thread
From: wenyi,xie @ 2022-08-18  2:26 UTC (permalink / raw)
  To: devel, jian.j.wang, gaoliming, zhichao.gao, ray.ni
  Cc: songdongkuang, xiewenyi2

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH EDK2 v2 1/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue
  2022-08-18  2:26 ` [PATCH EDK2 v2 1/1] " wenyi,xie
@ 2022-08-18  4:23   ` Sean
  2022-08-18 11:08     ` wenyi,xie
  0 siblings, 1 reply; 4+ messages in thread
From: Sean @ 2022-08-18  4:23 UTC (permalink / raw)
  To: devel@edk2.groups.io, xiewenyi2@huawei.com, jian.j.wang@intel.com,
	gaoliming@byosoft.com.cn, zhichao.gao@intel.com, ray.ni@intel.com
  Cc: songdongkuang@huawei.com, xiewenyi2@huawei.com

[-- Attachment #1: Type: text/plain, Size: 2126 bytes --]

These seem like perfect examples to write host based unit tests for the bmpsupportlib. Then you could run all sorts of different bmp contents thru the lib routines.

Have you thought about adding that

Thanks
Sean
________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of wenyi,xie via groups.io <xiewenyi2=huawei.com@groups.io>
Sent: Wednesday, August 17, 2022 7:26:07 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>; jian.j.wang@intel.com <jian.j.wang@intel.com>; gaoliming@byosoft.com.cn <gaoliming@byosoft.com.cn>; zhichao.gao@intel.com <zhichao.gao@intel.com>; ray.ni@intel.com <ray.ni@intel.com>
Cc: songdongkuang@huawei.com <songdongkuang@huawei.com>; xiewenyi2@huawei.com <xiewenyi2@huawei.com>
Subject: [edk2-devel] [PATCH EDK2 v2 1/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue

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







[-- Attachment #2: Type: text/html, Size: 3284 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH EDK2 v2 1/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue
  2022-08-18  4:23   ` [edk2-devel] " Sean
@ 2022-08-18 11:08     ` wenyi,xie
  0 siblings, 0 replies; 4+ messages in thread
From: wenyi,xie @ 2022-08-18 11:08 UTC (permalink / raw)
  To: Sean Brogan, 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



On 2022/8/18 12:23, Sean Brogan wrote:
> These seem like perfect examples to write host based unit tests for the bmpsupportlib. Then you could run all sorts of different bmp contents thru the lib routines. 
> 
> Have you thought about adding that

I think it's a good idea to add unit tests for the bmpsupportlib, I will try to add it later.

Thanks
Wenyi
> 
> Thanks
> Sean
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> *From:* devel@edk2.groups.io <devel@edk2.groups.io> on behalf of wenyi,xie via groups.io <xiewenyi2=huawei.com@groups.io>
> *Sent:* Wednesday, August 17, 2022 7:26:07 PM
> *To:* devel@edk2.groups.io <devel@edk2.groups.io>; jian.j.wang@intel.com <jian.j.wang@intel.com>; gaoliming@byosoft.com.cn <gaoliming@byosoft.com.cn>; zhichao.gao@intel.com <zhichao.gao@intel.com>; ray.ni@intel.com <ray.ni@intel.com>
> *Cc:* songdongkuang@huawei.com <songdongkuang@huawei.com>; xiewenyi2@huawei.com <xiewenyi2@huawei.com>
> *Subject:* [edk2-devel] [PATCH EDK2 v2 1/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue
>  
> 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
> 
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-18 11:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-18  2:26 [PATCH EDK2 v2 0/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue wenyi,xie
2022-08-18  2:26 ` [PATCH EDK2 v2 1/1] " wenyi,xie
2022-08-18  4:23   ` [edk2-devel] " Sean
2022-08-18 11:08     ` wenyi,xie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox