From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: "Ni, Ruiyu" <ruiyu.ni@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH] MdeModulePkg/DxeCapsuleLibFmp: Add more check for the UX capsule
Date: Fri, 16 Mar 2018 07:24:04 +0000 [thread overview]
Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503AB01E26@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <20180316070543.357716-1-ruiyu.ni@intel.com>
Reviewed-by: jiewen.yao@intel.com
> -----Original Message-----
> From: Ni, Ruiyu
> Sent: Friday, March 16, 2018 3:06 PM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen <jiewen.yao@intel.com>
> Subject: [PATCH] MdeModulePkg/DxeCapsuleLibFmp: Add more check for the
> UX capsule
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> ---
> .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c | 21
> +++++++++++++++++++--
> 1 file changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> index 15dbc00216..555c5971d0 100644
> --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> @@ -330,8 +330,25 @@ DisplayCapsuleImage (
> UINTN Width;
> EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
>
> - ImagePayload = (DISPLAY_DISPLAY_PAYLOAD *)(CapsuleHeader + 1);
> - PayloadSize = CapsuleHeader->CapsuleImageSize -
> sizeof(EFI_CAPSULE_HEADER);
> + //
> + // UX capsule doesn't have extended header entries.
> + //
> + if (CapsuleHeader->HeaderSize != sizeof (EFI_CAPSULE_HEADER)) {
> + return EFI_UNSUPPORTED;
> + }
> + ImagePayload = (DISPLAY_DISPLAY_PAYLOAD *)((UINTN) CapsuleHeader +
> CapsuleHeader->HeaderSize);
> + //
> + // (CapsuleImageSize > HeaderSize) is guaranteed by IsValidCapsuleHeader().
> + //
> + PayloadSize = CapsuleHeader->CapsuleImageSize -
> CapsuleHeader->HeaderSize;
> +
> + //
> + // Make sure the image payload at least contain the
> DISPLAY_DISPLAY_PAYLOAD header.
> + // Further size check is performed by the logic translating BMP to GOP BLT.
> + //
> + if (PayloadSize <= sizeof (DISPLAY_DISPLAY_PAYLOAD)) {
> + return EFI_INVALID_PARAMETER;
> + }
>
> if (ImagePayload->Version != 1) {
> return EFI_UNSUPPORTED;
> --
> 2.16.1.windows.1
prev parent reply other threads:[~2018-03-16 7:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-16 7:05 [PATCH] MdeModulePkg/DxeCapsuleLibFmp: Add more check for the UX capsule Ruiyu Ni
2018-03-16 7:24 ` Yao, Jiewen [this message]
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=74D8A39837DF1E4DA445A8C0B3885C503AB01E26@shsmsx102.ccr.corp.intel.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