[EXTERNAL] [edk2-devel] [PATCH 1/1] MdeModulePkg/BmpSupportLib: Allow BMP with extra data

Jeff Brasen jbrasen at nvidia.com
Wed Mar 24 15:25:12 UTC 2021


Some of the logo files we received for the group that makes our assets like this (not sure what tool they were created with) look like they pad the BMP size to 8 bytes.

TranslateBmpToGopBlt: invalid BmpImage...
   BmpHeader->Size: 0xE1038
   BmpHeader->ImageOffset: 0x36
   BmpImageSize: 0xE1038
   DataSize: 0xE1000
TranslateBmpToGopBlt: invalid BmpImage...
   BmpHeader->Size: 0x2A3038
   BmpHeader->ImageOffset: 0x36
   BmpImageSize: 0x2A3038
   DataSize: 0x2A3000
TranslateBmpToGopBlt: invalid BmpImage...
   BmpHeader->Size: 0x5EEC38
   BmpHeader->ImageOffset: 0x36
   BmpImageSize: 0x5EEC38
   DataSize: 0x5EEC00

So, each of these has 2 bytes of padding at the end of the file. We could write a tool that would do the same size recalculation in order to update the size in the header and remove the two bytes but it seems that this is a valid BMP file and it doesn't seem correct that UEFI is rejecting it. I can update the commit message with more context if needed as well.


Thanks,

Jeff

________________________________
From: Laszlo Ersek <lersek at redhat.com>
Sent: Wednesday, March 24, 2021 5:31 AM
To: devel at edk2.groups.io <devel at edk2.groups.io>; bret.barkelew at microsoft.com <bret.barkelew at microsoft.com>; Jeff Brasen <jbrasen at nvidia.com>
Cc: jian.j.wang at intel.com <jian.j.wang at intel.com>; ao.a.wu at intel.com <ao.a.wu at intel.com>
Subject: Re: [EXTERNAL] [edk2-devel] [PATCH 1/1] MdeModulePkg/BmpSupportLib: Allow BMP with extra data

External email: Use caution opening links or attachments


On 03/23/21 18:41, Bret Barkelew via groups.io wrote:
> Is this a *good* idea?
>
> What is considered valid extra data? If it’s immaterial to the FW displaying the image, our policy has been to strip it off BEFORE adding it to the FW image.

Not counting any potential security aspects, stripping out undisplayed
portions helps with flash usage too (I think?), so at least some
concrete justification in the commit message would be nice...

Thanks
Laszlo

>
> - Bret
>
> From: Jeff Brasen via groups.io<mailto:jbrasen=nvidia.com at groups.io>
> Sent: Tuesday, March 23, 2021 10:29 AM
> To: devel at edk2.groups.io<mailto:devel at edk2.groups.io>
> Cc: jian.j.wang at intel.com<mailto:jian.j.wang at intel.com>; ao.a.wu at intel.com<mailto:ao.a.wu at intel.com>; Jeff Brasen<mailto:jbrasen at nvidia.com>
> Subject: [EXTERNAL] [edk2-devel] [PATCH 1/1] MdeModulePkg/BmpSupportLib: Allow BMP with extra data
>
> Add support for processing BMP data that contains extra data after the
> image array, this data will not be parsed in anyway in the library but
> images that contain this will not be rejected from processing.
>
> ---
>  MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
> index 3ac31f6723d0..944d01fe7cdf 100644
> --- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
> +++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
> @@ -213,7 +213,7 @@ TranslateBmpToGopBlt (
>
>    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));
> --
> 2.25.1
>
>
>
>
>
>
>
>
> 
>
>
>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#73212): https://edk2.groups.io/g/devel/message/73212
Mute This Topic: https://groups.io/mt/81556871/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20210324/f848d00c/attachment.htm>


More information about the edk2-devel-archive mailing list