You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Rewriting the LOAD_DYLIB commands results in "Can't get the last load command"
To Reproduce
The general idea is you have some load_dylib command, so you create the new list of load_dylib commands and wipe out the old ones. Here is a sketch:
b = lief.parse(binary_path)
for library in b.libraries:
library_path = pathlib.Path(library.name)
print(f'\t{library_path}')
if path_to_replace and replacement_path:
if library.name.startswith(path_to_replace.as_posix()):
relative_library_path = library_path.relative_to(path_to_replace)
library_path = replacement_path / relative_library_path
lc_dylib = lief.MachO.DylibCommand.load_dylib(name=library_path.as_posix(),
timestamp=library.timestamp)
lc_dylib.compatibility_version = library.compatibility_version
lc_dylib.current_version = library.current_version
new_library = lc_dylib
old_libraries.append(library)
new_libraries.append(new_library)
Modifying the name property directly wrecks the load commands, hence, create a new load_dylib instead. Then b.remove and b.add the old and new version of the load_dylib commands maintaining the original ordering.
Expected behavior
Success. Instead each call to add gives "Can't get the last load command" and nothing is added.
Environment (please complete the following information):
Lief 15.1
Describe the bug
Rewriting the LOAD_DYLIB commands results in "Can't get the last load command"
To Reproduce
The general idea is you have some load_dylib command, so you create the new list of load_dylib commands and wipe out the old ones. Here is a sketch:
Modifying the name property directly wrecks the load commands, hence, create a new load_dylib instead. Then
b.remove
andb.add
the old and new version of the load_dylib commands maintaining the original ordering.Expected behavior
Success. Instead each call to add gives "Can't get the last load command" and nothing is added.
Environment (please complete the following information):
Lief 15.1
xar.zip
The text was updated successfully, but these errors were encountered: