Handle incorrect parameters passed to DisplayDxe GOP functions QueryMode(), SetMode(), and Blt().
This fixes Blt_Conf and QueryMode_Conf failures reported by SCT tests at: https://github.com/pftf/RPi4/issues/73 Cc: Leif Lindholm <l...@nuviainc.com> Cc: Pete Batard <p...@akeo.ie> Cc: Andrei Warkentin <awarken...@vmware.com> Cc: Ard Biesheuvel <ard.biesheu...@arm.com> Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahm...@arm.com> --- Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c b/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c index b880ca827bd6..80d0f7b2cb3c 100644 --- a/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c +++ b/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c @@ -1,5 +1,6 @@ /** @file * + * Copyright (c) 2020, ARM Limited. All rights reserved. * Copyright (c) 2017-2018, Andrei Warkentin <andrey.warken...@gmail.com> * Copyright (c) Microsoft Corporation. All rights reserved. * @@ -170,7 +171,7 @@ DisplayQueryMode ( EFI_STATUS Status; GOP_MODE_DATA *Mode; - if (ModeNumber > mLastMode) { + if (Info == NULL || SizeOfInfo == NULL || ModeNumber >= This->Mode->MaxMode) { return EFI_INVALID_PARAMETER; } @@ -227,7 +228,7 @@ DisplaySetMode ( EFI_PHYSICAL_ADDRESS FbBase; GOP_MODE_DATA *Mode = &mGopModeData[ModeNumber]; - if (ModeNumber > mLastMode) { + if (ModeNumber >= This->Mode->MaxMode) { return EFI_UNSUPPORTED; } @@ -299,6 +300,14 @@ DisplayBlt ( UINT8 *VidBuf, *BltBuf, *VidBuf1; UINTN i; + if ((UINTN)BltOperation >= EfiGraphicsOutputBltOperationMax) { + return EFI_INVALID_PARAMETER; + } + + if (Width == 0 || Height == 0) { + return EFI_INVALID_PARAMETER; + } + switch (BltOperation) { case EfiBltVideoFill: BltBuf = (UINT8*)BltBuffer; @@ -349,7 +358,7 @@ DisplayBlt ( break; default: - ASSERT_EFI_ERROR (EFI_SUCCESS); + return EFI_INVALID_PARAMETER; break; } -- 2.17.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#63040): https://edk2.groups.io/g/devel/message/63040 Mute This Topic: https://groups.io/mt/75717275/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-