From 9fc029ee6248e7998a478e02dc1abf82ac8ae376 Mon Sep 17 00:00:00 2001 From: Konstantin Aladyshev Date: Tue, 19 Jul 2022 21:44:35 +0800 Subject: [PATCH] BaseTools/VolInfo: Correct buffer for GenCrc32 tool 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 Reviewed-by: Liming Gao Reviewed-by: Bob Feng --- BaseTools/Source/C/VolInfo/VolInfo.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c index 135924e028..184d753ba4 100644 --- a/BaseTools/Source/C/VolInfo/VolInfo.c +++ b/BaseTools/Source/C/VolInfo/VolInfo.c @@ -2009,6 +2009,13 @@ Returns: ); free (ExtractionTool); + if (!CompareGuid ( + EfiGuid, + &gEfiCrc32GuidedSectionExtractionProtocolGuid + ) + ) { + DataOffset -= 4; + } Status = PutFileImage ( ToolInputFile, -- 2.39.2