Skip to content

Ensure that the data being read is actually large enough to have a debug directory entry parsed from it - #96

Merged
mnadareski merged 1 commit into
SabreTools:mainfrom
HeroponRikiBestest:debugTableSize
Jul 31, 2026
Merged

Ensure that the data being read is actually large enough to have a debug directory entry parsed from it#96
mnadareski merged 1 commit into
SabreTools:mainfrom
HeroponRikiBestest:debugTableSize

Conversation

@HeroponRikiBestest

Copy link
Copy Markdown
Contributor

For PE, no checks on the data size were performed to make sure that a debug directory entry could actually be parsed from the debug table, causing PE parsing to fail on some executables. In this specific case, the optionalheader has a debug table size of 1 byte, smaller than the 28 bytes needed to actually parse a debug directory entry.

Executable in question that this was failing on beforehand:
shuttle.zip

Comes from Space Shuttle Mission Simulator (not on redump yet)


int offset = 0;
while (offset < data.Length)
while (offset < data.Length && data.Length - offset >= 28)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at ParseDebugDirectoryEntry, it seems to parse 6 Uint32s and 2 Uint16s, so I assume that you need data to be at least 28 bytes long for this to actually succeed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that makes sense 👍

@mnadareski
mnadareski merged commit 2a604bd into SabreTools:main Jul 31, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants