mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 11:06:08 +00:00

`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.
17 lines
790 B
Plaintext
17 lines
790 B
Plaintext
RUN: yaml2obj %p/Inputs/MachO/rebase-bind-table-trailing-opcode.yaml | \
|
|
RUN: llvm-objdump --rebase --bind --weak-bind --macho - | \
|
|
RUN: FileCheck %s
|
|
|
|
CHECK: Rebase table:
|
|
CHECK-NEXT: segment section address type
|
|
CHECK-NEXT: __DATA_CONST __got 0x00008000 pointer
|
|
CHECK-NEXT: __DATA __la_symbol_ptr 0x0000C000 pointer
|
|
|
|
CHECK: Bind table:
|
|
CHECK-NEXT: segment section address type addend dylib symbol
|
|
CHECK-NEXT: __DATA_CONST __got 0x00008008 pointer 0 libSystem dyld_stub_binder
|
|
|
|
CHECK: Weak bind table:
|
|
CHECK-NEXT: segment section address type addend symbol
|
|
CHECK-NEXT: __DATA_CONST __got 0x00008000 pointer 0 _foo
|