From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.4447.1660581104463055022 for ; Mon, 15 Aug 2022 09:31:44 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: dimitrije.pavlov@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B87801477; Mon, 15 Aug 2022 09:31:44 -0700 (PDT) Received: from mammon-apollo-f36.austin.arm.com (mammon-apollo-f36.austin.arm.com [10.118.12.61]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CC5263F70D; Mon, 15 Aug 2022 09:31:43 -0700 (PDT) From: "Dimitrije Pavlov" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jiewen Yao , Liming Gao , Sunny Wang , Jeff Booher-Kaeding , Samer El-Haj-Mahmoud Subject: [PATCH v2 2/3] OvmfPkg/VirtioGpuDxe: Check QueryMode arguments Date: Mon, 15 Aug 2022 11:31:18 -0500 Message-Id: <20220815163119.2877228-3-dimitrije.pavlov@arm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815163119.2877228-1-dimitrije.pavlov@arm.com> References: <20220815163119.2877228-1-dimitrije.pavlov@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 Cc: Jiewen Yao Cc: Liming Gao Cc: Sunny Wang Cc: Jeff Booher-Kaeding Cc: Samer El-Haj-Mahmoud Signed-off-by: Dimitrije Pavlov --- OvmfPkg/VirtioGpuDxe/Gop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/VirtioGpuDxe/Gop.c b/OvmfPkg/VirtioGpuDxe/Gop.c index 401db47672ec..bb68b1cdc2bc 100644 --- a/OvmfPkg/VirtioGpuDxe/Gop.c +++ b/OvmfPkg/VirtioGpuDxe/Gop.c @@ -308,7 +308,9 @@ GopQueryMode ( { EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *GopModeInfo; =20 - if (ModeNumber >=3D This->Mode->MaxMode) { + if (Info =3D=3D NULL || + SizeOfInfo =3D=3D NULL || + ModeNumber >=3D This->Mode->MaxMode) { return EFI_INVALID_PARAMETER; } =20 --=20 2.37.2