Fix the bug to support PI not compressed compression section.
[efi/basetools/.git] / Source / C / GenSec / GenSec.c
index fdf0375..8c4f874 100644 (file)
@@ -646,6 +646,16 @@ Returns:
   switch (SectCompSubType) {\r
   case EFI_NOT_COMPRESSED:\r
     CompressedLength = InputLength;\r
+    //\r
+    // Copy file buffer to the none compressed data.\r
+    //\r
+    OutputBuffer = malloc (CompressedLength + sizeof (EFI_COMPRESSION_SECTION));\r
+    if (OutputBuffer == NULL) {\r
+      free (FileBuffer);\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
+    memcpy (OutputBuffer + sizeof (EFI_COMPRESSION_SECTION), FileBuffer, CompressedLength);\r
+    FileBuffer = OutputBuffer;\r
     break;\r
 \r
   case EFI_STANDARD_COMPRESSION:\r