[edk2-devel] [PATCH] [edk2-staging]BaseTools/Fmmt: fix Some RAW encounter dead loop issue

Feng, YunhuaX posted 1 patch 3 years, 10 months ago
Failed in applying to current master (apply log)
BaseTools/Source/C/FMMT/FirmwareModuleManagement.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
[edk2-devel] [PATCH] [edk2-staging]BaseTools/Fmmt: fix Some RAW encounter dead loop issue
Posted by Feng, YunhuaX 3 years, 10 months ago
Some RAW ffs parse section for check UI section will encounter dead loop.
Actually when FFS is raw FFS, not include UI section.

Change-Id: I40e1cbb988bed30d8757008bad9074bc11eae135
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
---
 BaseTools/Source/C/FMMT/FirmwareModuleManagement.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
index 89a7533deb..c8a53d3def 100644
--- a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
+++ b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
@@ -1,10 +1,10 @@
 /** @file

  FMMT main routine.

-Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent

 **/

 #include "FirmwareModuleManagement.h"
@@ -750,10 +750,16 @@ ParseSection (
   UISectionFlag       = FALSE;
   Ptr                 = NULL;
   SectionLength       = 0;
   ParsedLength        = GetFfsHeaderLength((EFI_FFS_FILE_HEADER *)InputFfs);
   FfsFileSize         = GetFfsFileLength((EFI_FFS_FILE_HEADER *)InputFfs);
+  //
+  //if RAW ffs, return FALSE
+  //
+  if (((EFI_FFS_FILE_HEADER*)InputFfs)->Type == EFI_FV_FILETYPE_RAW) {
+    return UISectionFlag;
+  }

   while (ParsedLength < FfsFileSize) {
     Ptr           = (UINT8 *)InputFfs + ParsedLength;
     SectionLength = GetLength (((EFI_COMMON_SECTION_HEADER *) Ptr)->Size);
     Type          = ((EFI_COMMON_SECTION_HEADER *) Ptr)->Type;
--
2.12.2.windows.2


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61396): https://edk2.groups.io/g/devel/message/61396
Mute This Topic: https://groups.io/mt/74933847/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-