Skip to content

Catch BinaryReader exceptions when reading stack variable parameters#1079

Merged
xusheng6 merged 1 commit into
devfrom
fix-debuggerinfo-readpointer-exception
May 14, 2026
Merged

Catch BinaryReader exceptions when reading stack variable parameters#1079
xusheng6 merged 1 commit into
devfrom
fix-debuggerinfo-readpointer-exception

Conversation

@xusheng6
Copy link
Copy Markdown
Member

Summary

  • DebuggerInfoTable::getInfoFor{LLIL,MLIL,HLIL}Calls each compute a stack offset (stack pointer + parameter slot) and pass it to BinaryReader::Seek + ReadPointer to show the parameter value next to a call in the info table. If the computed offset falls outside the BinaryView's range, ReadPointer throws ReadException. The caller is invoked from a Qt slot with no handler up the stack, so the unhandled C++ exception terminates the process.
  • Wrap each read in a try/catch and skip the parameter entry on failure. The widget still renders the remaining parameters normally. Applied to all three IL variants since they share the identical pattern (the Sentry-reported one is HLIL, the others are latent).

Fixes #1068
Fixes BINARYNINJA-47

Sentry context

Test plan

  • Open the Debugger Info widget on a target, exercise calls whose stack parameters land in valid mapped regions — confirm parameter values still display.
  • Exercise the bad path: hover/click a call where the computed stack offset is outside the BinaryView (e.g. very early in main before the stack is established, or with a custom raw view) — confirm the widget renders without crashing and just omits the unreadable entry.

🤖 Generated with Claude Code

DebuggerInfoTable::getInfoForLLIL/MLIL/HLILCalls each compute a stack
offset (stack pointer + parameter slot) and pass it to BinaryReader::Seek
+ ReadPointer to display the parameter value next to a call. If the
computed offset is outside the BinaryView, ReadPointer throws
ReadException, and since the caller is invoked from a Qt slot with no
handler up the stack, the unhandled exception terminates the process.

Wrap each read in a try/catch and skip the parameter entry on failure.
The widget renders the remaining parameters normally instead of taking
down the process. Fix applies to all three IL variants since they share
the identical pattern.

Fixes #1068
Fixes BINARYNINJA-47

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@xusheng6 xusheng6 merged commit c0598f6 into dev May 14, 2026
1 check passed
@xusheng6 xusheng6 deleted the fix-debuggerinfo-readpointer-exception branch May 14, 2026 16:10
xusheng6 added a commit that referenced this pull request May 14, 2026
Per review feedback on #1079: catch the specific exception type
(BinaryNinja::ReadException) instead of catch (...) when the throwing
API is known. The original catch-all could swallow unrelated failures
and hide intent. ReadException is the only exception BinaryReader::Seek
and ReadPointer raise here.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

Crash due to unhandled exception within DebuggerInfoTable::getInfoForHLILCalls

1 participant