diff --git a/src/apps/debugger/dwarf/DwarfFile.cpp b/src/apps/debugger/dwarf/DwarfFile.cpp index 8ef735321b..8d4ec5ab42 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(0) : dataReader.Read(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; } }