summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2024-09-25 20:52:34 -0400
committerJosh Ferrell <josh@vector35.com>2024-09-25 20:52:34 -0400
commitd5dbb30ffc81ebb8a6d47b6baef9ddcb954db717 (patch)
tree74e6fa244448534d4c379041e1cfdc454327a0f9
parent3e5ecf7a6d7ed6996eb62a8cfb4849e7556cec99 (diff)
Fix PE with invalid string table start failing to load
-rw-r--r--view/pe/peview.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/view/pe/peview.cpp b/view/pe/peview.cpp
index cfeb63b2..2980d667 100644
--- a/view/pe/peview.cpp
+++ b/view/pe/peview.cpp
@@ -759,8 +759,12 @@ bool PEView::Init()
BinaryReader stringReader(GetParentView(), LittleEndian);
uint64_t stringTableBase = header.coffSymbolTable + (header.coffSymbolCount * 18);
stringReader.Seek(stringTableBase);
- uint32_t stringTableLen = stringReader.Read32();
- if ((stringTableBase + stringTableLen) > GetParentView()->GetEnd())
+ uint32_t stringTableLen;
+ if (!stringReader.TryRead32(stringTableLen))
+ {
+ m_logger->LogError("Cannot resolve section name \"%s\": String table has invalid start", name);
+ }
+ else if ((stringTableBase + stringTableLen) > GetParentView()->GetEnd())
{
m_logger->LogError("Cannot resolve section name \"%s\": String table is invalid length", name);
}