diff options
| author | Mark Rowe <mark@vector35.com> | 2026-02-27 16:50:09 -0800 |
|---|---|---|
| committer | Mark Rowe <mark@vector35.com> | 2026-02-27 17:15:01 -0800 |
| commit | d92b3684825220345b902f93b22b160e9401012b (patch) | |
| tree | bf591a5a61b22e7574ce85ca111f5e1ab63b3a9e /view | |
| parent | 30cb29617d0db9f5953c7468f208e33920a2239d (diff) | |
[MachO] Fix incorrect handling of BIND_SPECIAL_DYLIB_*_LOOKUP in chained fixups
These lookup modes are negative values that are encoded in the library
ordinal, an unsigned field, of an import fixup entry. Incorrect sign
extension when converting these ordinals back to signed values led
to them being misinterpreted.
Diffstat (limited to 'view')
| -rw-r--r-- | view/macho/chained_fixups.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/view/macho/chained_fixups.cpp b/view/macho/chained_fixups.cpp index e4e6d160..9a8e8617 100644 --- a/view/macho/chained_fixups.cpp +++ b/view/macho/chained_fixups.cpp @@ -247,7 +247,7 @@ ImportEntry ReadChainedImport32(BinaryReader& reader, std::span<const char> symb return { std::string_view(&symbolData[import.name_offset]), 0, - static_cast<int32_t>(import.lib_ordinal), + static_cast<int8_t>(import.lib_ordinal), (bool)import.weak_import, }; } @@ -259,7 +259,7 @@ ImportEntry ReadChainedImportAddend32(BinaryReader& reader, std::span<const char return { std::string_view(&symbolData[import.name_offset]), static_cast<uint32_t>(import.addend), - static_cast<int32_t>(import.lib_ordinal), + static_cast<int8_t>(import.lib_ordinal), (bool)import.weak_import, }; } @@ -271,7 +271,7 @@ ImportEntry ReadChainedImportAddend64(BinaryReader& reader, std::span<const char return { std::string_view(&symbolData[import.name_offset]), import.addend, - static_cast<int32_t>(import.lib_ordinal), + static_cast<int16_t>(import.lib_ordinal), (bool)import.weak_import, }; } |
