aboutsummaryrefslogtreecommitdiff
path: root/lib/Object/MachOObjectFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Object/MachOObjectFile.cpp')
-rw-r--r--lib/Object/MachOObjectFile.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp
index f5910dd95d..d26eb2ce61 100644
--- a/lib/Object/MachOObjectFile.cpp
+++ b/lib/Object/MachOObjectFile.cpp
@@ -405,7 +405,7 @@ MachOObjectFile::MachOObjectFile(MemoryBuffer *Object,
macho::LCT_Segment64 : macho::LCT_Segment;
MachOObjectFile::LoadCommandInfo Load = getFirstLoadCommandInfo();
- for (unsigned I = 0; I < LoadCommandCount; ++I) {
+ for (unsigned I = 0; ; ++I) {
if (Load.C.Type == macho::LCT_Symtab) {
assert(!SymtabLoadCmd && "Multiple symbol tables");
SymtabLoadCmd = Load.Ptr;
@@ -418,7 +418,11 @@ MachOObjectFile::MachOObjectFile(MemoryBuffer *Object,
Sections.push_back(reinterpret_cast<const char*>(Sec));
}
}
- Load = getNextLoadCommandInfo(Load);
+
+ if (I == LoadCommandCount - 1)
+ break;
+ else
+ Load = getNextLoadCommandInfo(Load);
}
}