public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Jeff Brasen" <jbrasen@nvidia.com>
To: Laszlo Ersek <lersek@redhat.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"bret.barkelew@microsoft.com" <Bret.Barkelew@microsoft.com>
Cc: "jian.j.wang@intel.com" <jian.j.wang@intel.com>,
	"ao.a.wu@intel.com" <ao.a.wu@intel.com>
Subject: Re: [EXTERNAL] [edk2-devel] [PATCH 1/1] MdeModulePkg/BmpSupportLib: Allow BMP with extra data
Date: Wed, 24 Mar 2021 15:25:12 +0000	[thread overview]
Message-ID: <DM6PR12MB33408C106C304BF5EEA64609CB639@DM6PR12MB3340.namprd12.prod.outlook.com> (raw)
In-Reply-To: <ce9294ba-18dd-ca26-ec13-7ae1aabda436@redhat.com>

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

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@redhat.com>
Sent: Wednesday, March 24, 2021 5:31 AM
To: devel@edk2.groups.io <devel@edk2.groups.io>; bret.barkelew@microsoft.com <bret.barkelew@microsoft.com>; Jeff Brasen <jbrasen@nvidia.com>
Cc: jian.j.wang@intel.com <jian.j.wang@intel.com>; ao.a.wu@intel.com <ao.a.wu@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@groups.io>
> Sent: Tuesday, March 23, 2021 10:29 AM
> To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
> Cc: jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>; ao.a.wu@intel.com<mailto:ao.a.wu@intel.com>; Jeff Brasen<mailto:jbrasen@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
>
>
>
>
>
>
>
>
> 
>
>
>


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

  reply	other threads:[~2021-03-24 15:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 17:29 [PATCH 1/1] MdeModulePkg/BmpSupportLib: Allow BMP with extra data Jeff Brasen
2021-03-23 17:41 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
2021-03-24 11:31   ` Laszlo Ersek
2021-03-24 15:25     ` Jeff Brasen [this message]
2021-03-24 18:26       ` Laszlo Ersek
2021-03-25  3:00         ` Andrew Fish
2021-03-30  1:35           ` Gao, Zhichao
2021-04-01 17:37             ` Bret Barkelew
2021-04-16 17:12               ` Jeff Brasen

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=DM6PR12MB33408C106C304BF5EEA64609CB639@DM6PR12MB3340.namprd12.prod.outlook.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