mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
Don't read one command past the end.
Thanks to Evgeniy Stepanov for reporting this. It might be a good idea to add a command iterator abstraction to MachO.h, but this fixes the bug for now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179848 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -205,7 +205,7 @@ getSectionsAndSymbols(const macho::Header Header,
|
||||
|
||||
MachOObjectFile::LoadCommandInfo Command =
|
||||
MachOObj->getFirstLoadCommandInfo();
|
||||
for (unsigned i = 0; i != Header.NumLoadCommands; ++i) {
|
||||
for (unsigned i = 0; ; ++i) {
|
||||
if (Command.C.Type == macho::LCT_FunctionStarts) {
|
||||
// We found a function starts segment, parse the addresses for later
|
||||
// consumption.
|
||||
@ -214,7 +214,11 @@ getSectionsAndSymbols(const macho::Header Header,
|
||||
|
||||
MachOObj->ReadULEB128s(LLC.DataOffset, FoundFns);
|
||||
}
|
||||
Command = MachOObj->getNextLoadCommandInfo(Command);
|
||||
|
||||
if (i == Header.NumLoadCommands - 1)
|
||||
break;
|
||||
else
|
||||
Command = MachOObj->getNextLoadCommandInfo(Command);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user