[llvm] [MachO] Fix copy-paste condition in bounds check (PR #100176)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 23 11:32:37 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-binary-utilities

Author: Daniel Bertalan (BertalanD)

<details>
<summary>Changes</summary>

I made this thinko in 686d8ce.

Note that that change was never intended to be permanent, and served as a quick stopgap to facilitate testing chained fixups in LLD before Apple upstreamed their implementation. That has not yet happened in the two years since.

Fixes #<!-- -->90662
Fixes #<!-- -->87203

---
Full diff: https://github.com/llvm/llvm-project/pull/100176.diff


1 Files Affected:

- (modified) llvm/lib/Object/MachOObjectFile.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index 812b2c00ba699..2a17b496fd62b 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -5193,7 +5193,7 @@ MachOObjectFile::getDyldChainedFixupTargets() const {
   const char *Symbols = Contents + Header.symbols_offset;
   const char *SymbolsEnd = Contents + DyldChainedFixups.datasize;
 
-  if (ImportsEnd > Symbols)
+  if (ImportsEnd > SymbolsEnd)
     return malformedError("bad chained fixups: imports end " +
                           Twine(ImportsEndOffset) + " extends past end " +
                           Twine(DyldChainedFixups.datasize));

``````````

</details>


https://github.com/llvm/llvm-project/pull/100176


More information about the llvm-commits mailing list