[edk2-devel] [PATCH v3 2/3] OvmfPkg/VirtioGpuDxe: Check QueryMode arguments

Dimitrije Pavlov Dimitrije.Pavlov at arm.com
Tue Aug 16 20:28:36 UTC 2022


The current implementation does not check if Info or SizeInfo
pointers are NULL. This causes the SCT test suite to crash.

Add a check to return EFI_INVALID_PARAMETER if any of these
pointers are NULL.

Cc: Ard Biesheuvel <ardb+tianocore at kernel.org>
Cc: Jiewen Yao <jiewen.yao at intel.com>
Cc: Liming Gao <gaoliming at byosoft.com.cn>
Cc: Sunny Wang <Sunny.Wang at arm.com>
Cc: Jeff Booher-Kaeding <Jeff.Booher-Kaeding at arm.com>
Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud at arm.com>

Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov at arm.com>
Reviewed-by: Sunny Wang <sunny.wang at arm.com>
---
 OvmfPkg/VirtioGpuDxe/Gop.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/VirtioGpuDxe/Gop.c b/OvmfPkg/VirtioGpuDxe/Gop.c
index 401db47672ec..16e92830d411 100644
--- a/OvmfPkg/VirtioGpuDxe/Gop.c
+++ b/OvmfPkg/VirtioGpuDxe/Gop.c
@@ -308,7 +308,10 @@ GopQueryMode (
 {
   EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  *GopModeInfo;
 
-  if (ModeNumber >= This->Mode->MaxMode) {
+  if ((Info == NULL) ||
+      (SizeOfInfo == NULL) ||
+      (ModeNumber >= This->Mode->MaxMode))
+  {
     return EFI_INVALID_PARAMETER;
   }
 
-- 
2.37.2



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




More information about the edk2-devel-archive mailing list