aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/MachOObjectFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r--llvm/lib/Object/MachOObjectFile.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index e408062..2f463a1 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -2997,7 +2997,9 @@ void ExportEntry::pushNode(uint64_t offset) {
return;
}
if (O != nullptr) {
- if (State.Other > O->getLibraryCount()) {
+ // Only positive numbers represent library ordinals. Zero and negative
+ // numbers have special meaning (see BindSpecialDylib).
+ if ((int64_t)State.Other > 0 && State.Other > O->getLibraryCount()) {
*E = malformedError(
"bad library ordinal: " + Twine((int)State.Other) + " (max " +
Twine((int)O->getLibraryCount()) +