aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/ELFObjectFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Object/ELFObjectFile.cpp')
-rw-r--r--llvm/lib/Object/ELFObjectFile.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp
index 28b96c3..8f7eead 100644
--- a/llvm/lib/Object/ELFObjectFile.cpp
+++ b/llvm/lib/Object/ELFObjectFile.cpp
@@ -805,7 +805,10 @@ Expected<std::vector<BBAddrMap>> static readBBAddrMapImpl(
return createError("unable to get the linked-to section for " +
describe(EF, Sec) + ": " +
toString(TextSecOrErr.takeError()));
- if (*TextSectionIndex != std::distance(Sections.begin(), *TextSecOrErr))
+ assert(*TextSecOrErr >= Sections.begin() &&
+ "Text section pointer outside of bounds");
+ if (*TextSectionIndex !=
+ (unsigned)std::distance(Sections.begin(), *TextSecOrErr))
return false;
return true;
};