summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python
diff options
context:
space:
mode:
authorMichael D Kinney <michael.d.kinney@intel.com>2026-05-19 23:07:19 +0300
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2026-06-22 18:18:12 +0300
commit57164cdc87cfc42083310062720d0a2eeef92bac (patch)
tree1e4a1365de9d8afdc83ba6c87e9518bf1f3b1174 /BaseTools/Source/Python
parent2a4022b6ae4652515aa215e00f856f899693a2a3 (diff)
downloadedk2-57164cdc87cfc42083310062720d0a2eeef92bac.tar.xz
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 <michael.d.kinney@intel.com>
Diffstat (limited to 'BaseTools/Source/Python')
-rw-r--r--BaseTools/Source/Python/GenFds/FdfParser.py4
1 files 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