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

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


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

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

>From 65bf6d58531147d991dc6e58772cd3053ab61eb1 Mon Sep 17 00:00:00 2001
From: Daniel Bertalan <dani at danielbertalan.dev>
Date: Tue, 23 Jul 2024 20:20:59 +0200
Subject: [PATCH] [MachO] Fix copy-paste condition in bounds check

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
---
 llvm/lib/Object/MachOObjectFile.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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));



More information about the llvm-commits mailing list