[llvm] 7da1dbb - [MachO] Remove redundant bounds check (#100176)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 1 10:14:14 PDT 2024
Author: Daniel Bertalan
Date: 2024-08-01T19:14:11+02:00
New Revision: 7da1dbb632ca490c2ab3c2d6ff46cccda38c7acd
URL: https://github.com/llvm/llvm-project/commit/7da1dbb632ca490c2ab3c2d6ff46cccda38c7acd
DIFF: https://github.com/llvm/llvm-project/commit/7da1dbb632ca490c2ab3c2d6ff46cccda38c7acd.diff
LOG: [MachO] Remove redundant bounds check (#100176)
The condition was duplicated, the correct one for this message would
have been `ImportsEnd > SymbolsEnd`. However, this is a subset of
`ImportEnd > Symbols` (since `Symbols <= SymbolsEnd`), so it can be
removed altogether.
I made this thinko in 686d8ce.
Note that that change wasn't intended to be permanent, and served as a
quick stopgap to facilitate testing chained fixups in LLD before Apple
upstreamed their implementation.
Fixes #90662
Fixes #87203
Added:
Modified:
llvm/lib/Object/MachOObjectFile.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index 812b2c00ba699..ff55a847c3432 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -5193,11 +5193,6 @@ MachOObjectFile::getDyldChainedFixupTargets() const {
const char *Symbols = Contents + Header.symbols_offset;
const char *SymbolsEnd = Contents + DyldChainedFixups.datasize;
- if (ImportsEnd > Symbols)
- return malformedError("bad chained fixups: imports end " +
- Twine(ImportsEndOffset) + " extends past end " +
- Twine(DyldChainedFixups.datasize));
-
if (ImportsEnd > Symbols)
return malformedError("bad chained fixups: imports end " +
Twine(ImportsEndOffset) + " overlaps with symbols");
More information about the llvm-commits
mailing list