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
I try to set target.dyld_info.bind_opcodes on a MachO binary. The property seems to be set to the expected value before the write method, but is back to the previous value when write the modified binary.
To Reproduce
binary=lief.MachO.parse("/bin/ls")
target=binary.at(1) # with target.header.cpu_type == lief.MachO.CPU_TYPES.ARM64opcodes=target.dyld_info.bind_opcodes.tobytes()
print("origin =", opcodes[:20].hex())
# change opcode target.dyld_info.bind_opcodes= [0] *len(opcodes)
print("change =", target.dyld_info.bind_opcodes.tobytes()[:20].hex())
# write library in outputfiletarget.write(outputfile)
print("write =", target.dyld_info.bind_opcodes.tobytes()[:20].hex())
# get opcode of outputfilebinary2=lief.MachO.parse(outputfile)
print("outputfile =", binary2.at(0).dyld_info.bind_opcodes.tobytes()[:20].hex())
Yes actually you can't modify the raw Dyld opcodes as they are recomputed in the build process. Nevertheless I could add an option in the build process to avoid this re-computation.
Describe the bug
I try to set
target.dyld_info.bind_opcodes
on a MachO binary. The property seems to be set to the expected value before thewrite
method, but is back to the previous value when write the modified binary.To Reproduce
returns
Expected behavior
The opcode is replaced in the output binary.
Environment (please complete the following information):
pip install lief
)Additional context
n/a
The text was updated successfully, but these errors were encountered: