hrev48310 adds 1 changeset to branch 'master' old head: a46669aa1c77b639e47cd4422e70956fd473bd8e new head: c87c95791ef7efc2f7ad566824217007e1949d08 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=c87c957+%5Ea46669a ---------------------------------------------------------------------------- c87c957: Debugger: Fix CFI length computation. - Due to a slight oversight during optimization refactoring, the length of the FDE's call frame instructions would sometimes be computed incorrectly, leading us to overflow past the end of the instructions, and fail to unwind the frame correctly if the address in question fell at the end. Fixes a regression introduced in commit d390ebee9e7355ca364f0e105374a33907a5a7cb. [ Rene Gollent <rene@xxxxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev48310 Commit: c87c95791ef7efc2f7ad566824217007e1949d08 URL: http://cgit.haiku-os.org/haiku/commit/?id=c87c957 Author: Rene Gollent <rene@xxxxxxxxxxx> Date: Sun Nov 16 05:15:11 2014 UTC ---------------------------------------------------------------------------- 1 file changed, 5 insertions(+), 5 deletions(-) src/apps/debugger/dwarf/DwarfFile.cpp | 10 +++++----- ---------------------------------------------------------------------------- diff --git a/src/apps/debugger/dwarf/DwarfFile.cpp b/src/apps/debugger/dwarf/DwarfFile.cpp index 8ef7353..8d4ec5a 100644 --- a/src/apps/debugger/dwarf/DwarfFile.cpp +++ b/src/apps/debugger/dwarf/DwarfFile.cpp @@ -1900,10 +1900,6 @@ DwarfFile::_UnwindCallFrame(CompilationUnit* unit, uint8 addressSize, if (cieRemaining < 0) return B_BAD_DATA; - uint64 remaining = lengthOffset + length - info->fdeOffset; - if (remaining < 0) - return B_BAD_DATA; - // skip CIE ID, initial offset and range, since we already know those // from FDELookupInfo. dwarf64 ? dataReader.Read<uint64>(0) : dataReader.Read<uint32>(0); @@ -1947,6 +1943,10 @@ DwarfFile::_UnwindCallFrame(CompilationUnit* unit, uint8 addressSize, if (error != B_OK) return error; + uint64 remaining = lengthOffset + length - dataReader.Offset(); + if (remaining < 0) + return B_BAD_DATA; + DataReader restrictedReader = dataReader.RestrictedReader(remaining); error = _ParseFrameInfoInstructions(unit, context, @@ -2552,7 +2552,7 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, } default: - WARNING(" unknown opcode %u!\n", opcode); + TRACE_CFI(" unknown opcode %u!\n", opcode); return B_BAD_DATA; } }