From 57164cdc87cfc42083310062720d0a2eeef92bac Mon Sep 17 00:00:00 2001 From: Michael D Kinney Date: Tue, 19 May 2026 13:07:19 -0700 Subject: [PATCH] BaseTools/GenFds: Fix FV attribute parser to allow any keyword order Fix _GetFvAttributes() to return True when it has successfully parsed at least one attribute before encountering a non-attribute keyword. Previously it always returned False on encountering an unrecognized word, even after consuming prior attributes. This caused the outer parsing loop to break prematurely when FvForceRebase, FvBaseAddress, or FvAlignment appeared between FV attribute flags (e.g. between ERASE_POLARITY and MEMORY_MAPPED), resulting in a Python stack trace. Move IsWordToken assignment to after successful attribute parsing and change the early return from 'return False' to 'return IsWordToken'. Signed-off-by: Michael D Kinney --- BaseTools/Source/Python/GenFds/FdfParser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index f61d0f299d..532f354b4d 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -2210,7 +2210,6 @@ class FdfParser: def _GetFvAttributes(self, FvObj): IsWordToken = False while self._GetNextWord(): - IsWordToken = True name = self._Token if name not in {"ERASE_POLARITY", "MEMORY_MAPPED", \ "STICKY_WRITE", "LOCK_CAP", "LOCK_STATUS", "WRITE_ENABLED_CAP", \ @@ -2219,7 +2218,7 @@ class FdfParser: "READ_LOCK_STATUS", "WRITE_LOCK_CAP", "WRITE_LOCK_STATUS", \ "WRITE_POLICY_RELIABLE", "WEAK_ALIGNMENT", "FvUsedSizeEnable"}: self._UndoToken() - return False + return IsWordToken if not self._IsToken(TAB_EQUAL_SPLIT): raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber) @@ -2228,6 +2227,7 @@ class FdfParser: raise Warning.Expected("TRUE/FALSE (1/0)", self.FileName, self.CurrentLineNumber) FvObj.FvAttributeDict[name] = self._Token + IsWordToken = True return IsWordToken