Skip to content

Commit 519bda8

Browse files
committed
AdvLoggerPkg: Minor fix in DecodeUefiLog.py _GetNextMessageBlock()
The function calls `self._ReadMessageEntry()` to read the next message entry from the log file. That function can return `None` for the `MessageEntry` if it encounters an invalid signature. This function needs to handle that case properly to avoid trying to access fields of a `None` object, which would lead to an `AttributeError`. Signed-off-by: Michael Kubacki <[email protected]>
1 parent fc05e0b commit 519bda8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

AdvLoggerPkg/Application/DecodeUefiLog/DecodeUefiLog.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,10 @@ def _GetNextMessageBlock(self, LoggerInfo):
588588

589589
(MessageEntry, NextMessage) = self._ReadMessageEntry(LoggerInfo)
590590

591+
if MessageEntry is None:
592+
print("Invalid message signature at offset 0x%x" % InFile.tell())
593+
raise Exception("Message block has the wrong signature at offset 0x%x" % InFile.tell())
594+
591595
if MessageEntry["Signature"] != 'ALMS' and MessageEntry["Signature"] != 'ALM2':
592596
print("Log signature was incorrect. Should be either 'ALMS' or 'ALM2', was '%s'" % MessageEntry["Signature"])
593597
raise Exception("Message Block has wrong signature at offset 0x%X" % InFile.tell())

0 commit comments

Comments
 (0)