mirror of https://github.com/acidanthera/audk.git
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> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
parent
a2f32ef6ff
commit
d0976b9acc
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue