]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/VolInfo: Correct buffer for GenCrc32 tool
authorKonstantin Aladyshev <aladyshev22@gmail.com>
Tue, 19 Jul 2022 13:44:35 +0000 (21:44 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sun, 2 Oct 2022 05:34:38 +0000 (05:34 +0000)
If the guided section was encoded with GenCrc32 tool the resulting
'EFI_GUID_DEFINED_SECTION.DataOffset' field points to the start of
the meaningfull data that follows the CRC32 value.
But if we want to decode the section with GenCrc32 tool we need to
provide a buffer that includes the CRC32 value itself.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Source/C/VolInfo/VolInfo.c

index 135924e02852c09c7b2640cce80f68d0aceff6fc..184d753ba46e4fc460dfc318d9762773002a48e6 100644 (file)
@@ -2009,6 +2009,13 @@ Returns:
           );\r
         free (ExtractionTool);\r
 \r
+        if (!CompareGuid (\r
+               EfiGuid,\r
+               &gEfiCrc32GuidedSectionExtractionProtocolGuid\r
+               )\r
+           ) {\r
+          DataOffset -= 4;\r
+        }\r
         Status =\r
           PutFileImage (\r
             ToolInputFile,\r