]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/PlatformInitLib: Add check to NvVarStoreFV HeaderLength
authorMin M Xu <min.m.xu@intel.com>
Sun, 27 Nov 2022 07:00:14 +0000 (15:00 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 2 Dec 2022 01:06:01 +0000 (01:06 +0000)
There should be a check that the FV HeaderLength cannot be an odd
number. Otherwise in the following CalculateSum16 there would be an
ASSERT.

In ValidateFvHeader@QemuFlashFvbServicesRuntimeDxe/FwBlockServices.c
there a is similar check to the FwVolHeader->HeaderLength.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
OvmfPkg/Library/PlatformInitLib/Platform.c

index 2582689ffe3518508e9ee6fcac0355fcf5e4140d..77f22de046f2c1e62b7a9eeceec8b19c5bc77491 100644 (file)
@@ -653,6 +653,7 @@ PlatformValidateNvVarStore (
       (!CompareGuid (&FvHdrGUID, &NvVarStoreFvHeader->FileSystemGuid)) ||\r
       (NvVarStoreFvHeader->Signature != EFI_FVH_SIGNATURE) ||\r
       (NvVarStoreFvHeader->Attributes != 0x4feff) ||\r
+      ((NvVarStoreFvHeader->HeaderLength & 0x01) != 0) ||\r
       (NvVarStoreFvHeader->Revision != EFI_FVH_REVISION) ||\r
       (NvVarStoreFvHeader->FvLength != NvVarStoreSize)\r
       )\r