From 6e372c8fe4c2890e74798fbb0fec2fbe1e37774e Mon Sep 17 00:00:00 2001 From: Xusheng Date: Thu, 14 May 2026 11:58:34 -0400 Subject: [PATCH] Catch BinaryReader exceptions when reading stack variable parameters 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) --- ui/debuggerinfowidget.cpp | 45 +++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/ui/debuggerinfowidget.cpp b/ui/debuggerinfowidget.cpp index b5082ea3..ab1ec0a1 100644 --- a/ui/debuggerinfowidget.cpp +++ b/ui/debuggerinfowidget.cpp @@ -92,9 +92,18 @@ std::vector DebuggerInfoTable::getInfoForLLILCalls(LowLevelIL offset -= arch->GetAddressSize(); auto realOffset = offset + m_debugger->StackPointer(); - BinaryReader reader(m_data); - reader.Seek(realOffset); - auto value = reader.ReadPointer(); + uint64_t value = 0; + try + { + BinaryReader reader(m_data); + reader.Seek(realOffset); + value = reader.ReadPointer(); + } + catch (...) + { + // realOffset is outside the binary view; skip this entry + break; + } auto hints = m_debugger->GetAddressInformation(value); auto paramName = func->GetVariableName(param); @@ -311,9 +320,18 @@ std::vector DebuggerInfoTable::getInfoForMLILCalls(MediumLeve offset -= arch->GetAddressSize(); auto realOffset = offset + m_debugger->StackPointer(); - BinaryReader reader(m_data); - reader.Seek(realOffset); - auto value = reader.ReadPointer(); + uint64_t value = 0; + try + { + BinaryReader reader(m_data); + reader.Seek(realOffset); + value = reader.ReadPointer(); + } + catch (...) + { + // realOffset is outside the binary view; skip this entry + break; + } auto hints = m_debugger->GetAddressInformation(value); auto paramName = func->GetVariableName(param); @@ -484,9 +502,18 @@ std::vector DebuggerInfoTable::getInfoForHLILCalls(HighLevelI offset -= arch->GetAddressSize(); auto realOffset = offset + m_debugger->StackPointer(); - BinaryReader reader(m_data); - reader.Seek(realOffset); - auto value = reader.ReadPointer(); + uint64_t value = 0; + try + { + BinaryReader reader(m_data); + reader.Seek(realOffset); + value = reader.ReadPointer(); + } + catch (...) + { + // realOffset is outside the binary view; skip this entry + break; + } auto hints = m_debugger->GetAddressInformation(value); auto paramName = func->GetVariableName(param);