summaryrefslogtreecommitdiff
path: root/bootstrap/llvm16/macho32.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2024-07-30 09:27:38 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2024-08-22 13:01:47 -0500
commitc2df0cfb7b126b4ccca129cb60b75c33d8005884 (patch)
treed8f520e8917d9dcc6097f2726bded656d97da93a /bootstrap/llvm16/macho32.patch
parent3090842aeb9dadca2ea666cebb6f563433ef2370 (diff)
downloadpackages-c2df0cfb7b126b4ccca129cb60b75c33d8005884.tar.gz
packages-c2df0cfb7b126b4ccca129cb60b75c33d8005884.tar.bz2
packages-c2df0cfb7b126b4ccca129cb60b75c33d8005884.tar.xz
packages-c2df0cfb7b126b4ccca129cb60b75c33d8005884.zip
bootstrap/llvm16: New package
Diffstat (limited to 'bootstrap/llvm16/macho32.patch')
-rw-r--r--bootstrap/llvm16/macho32.patch17
1 files changed, 17 insertions, 0 deletions
diff --git a/bootstrap/llvm16/macho32.patch b/bootstrap/llvm16/macho32.patch
new file mode 100644
index 000000000..31279d502
--- /dev/null
+++ b/bootstrap/llvm16/macho32.patch
@@ -0,0 +1,17 @@
+Use integer offset math instead of pointer math to determine load
+command bounds.
+
+Upstream-URL: https://github.com/llvm/llvm-project/issues/56746
+
+--- llvm-14.0.6.src/lib/Object/MachOObjectFile.cpp.old 2022-06-22 16:46:24.000000000 +0000
++++ llvm-14.0.6.src/lib/Object/MachOObjectFile.cpp 2022-11-28 04:21:02.730211841 +0000
+@@ -190,7 +190,8 @@
+ getLoadCommandInfo(const MachOObjectFile &Obj, const char *Ptr,
+ uint32_t LoadCommandIndex) {
+ if (auto CmdOrErr = getStructOrErr<MachO::load_command>(Obj, Ptr)) {
+- if (CmdOrErr->cmdsize + Ptr > Obj.getData().end())
++ uint64_t Offset = Ptr - Obj.getData().begin();
++ if (CmdOrErr->cmdsize + Offset > Obj.getData().size())
+ return malformedError("load command " + Twine(LoadCommandIndex) +
+ " extends past end of file");
+ if (CmdOrErr->cmdsize < 8)