apple / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. This fork is used to manage Apple’s stable releases of Clang as well as support the Swift project.
https://llvm.org
Other
1.1k stars 320 forks source link

🍒[release/6.0][MachO] Stop parsing past end of rebase/bind table (#93897) #8833

Closed zixu-w closed 1 month ago

zixu-w commented 1 month ago

MachORebaseEntry::moveNext() and MachOBindEntry::moveNext() assume that the rebase/bind table ends with {REBASE|BIND}_OPCODE_DONE or an actual rebase/bind. However a valid rebase/bind table might also end with other effectively no-op opcodes, which caused the parser to move past the end and go into the next table, resulting in corrupted entries or infinite loops.

(cherry picked from commit 1fa073ab896e65c55ff63487be0b41d7cea9aa77)

zixu-w commented 1 month ago

@swift-ci please test

zixu-w commented 1 month ago

Hi @fredriss could you help merge this PR? Thanks!