mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
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>
This commit is contained in:
parent
2a4022b6ae
commit
57164cdc87
1 changed files with 2 additions and 2 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue