forked from OSchip/llvm-project
[llvm-objdump] Don't disassemble symbols before SectionAddr
This was caught by UBSAN tools/llvm-objdump/X86/macho-disassembly-g-dsym.test tools/llvm-objdump/X86/hex-displacement.test llvm-svn: 358806
This commit is contained in:
parent
4d4b5d952e
commit
ce12ea8dfc
|
@ -1148,13 +1148,15 @@ static void disassembleObject(const Target *TheTarget, const ObjectFile *Obj,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint64_t Start = std::get<0>(Symbols[SI]);
|
uint64_t Start = std::get<0>(Symbols[SI]);
|
||||||
|
if (Start < SectionAddr || StopAddress <= Start)
|
||||||
|
continue;
|
||||||
|
|
||||||
// The end is the section end, the beginning of the next symbol, or
|
// The end is the section end, the beginning of the next symbol, or
|
||||||
// --stop-address.
|
// --stop-address.
|
||||||
uint64_t End = std::min<uint64_t>(SectionAddr + SectSize, StopAddress);
|
uint64_t End = std::min<uint64_t>(
|
||||||
if (SI + 1 < SE)
|
SI + 1 < SE ? std::get<0>(Symbols[SI + 1]) : SectionAddr + SectSize,
|
||||||
End = std::min(End, std::get<0>(Symbols[SI + 1]));
|
StopAddress);
|
||||||
if (Start >= End || Start >= StopAddress || End <= StartAddress)
|
if (Start >= End || End <= StartAddress)
|
||||||
continue;
|
continue;
|
||||||
Start -= SectionAddr;
|
Start -= SectionAddr;
|
||||||
End -= SectionAddr;
|
End -= SectionAddr;
|
||||||
|
|
Loading…
Reference in New Issue