P1: Byte patching for the decompiler CLI (patch set/get/list/delete)#210
Closed
mahaloz wants to merge 1 commit into
Closed
P1: Byte patching for the decompiler CLI (patch set/get/list/delete)#210mahaloz wants to merge 1 commit into
mahaloz wants to merge 1 commit into
Conversation
DecLib already had a Patch artifact; this exposes it via the CLI and fills backend gaps. - New `decompiler patch set|get|list|delete`. - IDA: set via patch_bytes (existing), enumerate via visit_patched_bytes (existing), plus new `_del_patch` that reverts to original bytes (get_original_byte). Full get/list/delete/revert support. - Ghidra: implemented `_set_patch` via Memory.setBytes — flips the block writable and clears the conflicting code unit first (setBytes refuses to overwrite bytes under a defined instruction), then re-disassembles. - Binary Ninja: implemented `_set_patch` via bv.write (was a warn-stub). - angr: no user-patch store (patch set reports rejected). - Base public get_patch/delete_patch (direct reads) + client proxies. - Tests: patch set reflects in read_memory + revert restores original bytes (IDA); get/list enumeration (IDA); Ghidra set verified; angr set rejected. SKILL.md / docs updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HfZHdprXg38re1XyKxzGg5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
DecLib already models
Patchand IDA/Binja had partial implementations, but there was no CLI command and backend parity was incomplete. This exposes patching and fills the gaps.New capabilities
decompiler patch set|get|list|delete.setviapatch_bytes(existing),listviavisit_patched_bytes(existing), and a new_del_patchthat reverts to original bytes (get_original_byte). Full set/get/list/delete(revert)._set_patchviaMemory.setBytes— flips the block writable and clears the conflicting code unit first (setBytesrefuses to overwrite bytes under a defined instruction: "Memory change conflicts with instruction"), then re-disassembles._set_patchviabv.write(was a warn-stub returning False).setreports rejected.get_patch/delete_patch(direct reads) + client proxies.Example
Tests
test_patch_set_reflects_in_memory(set →read_memoryshows patched bytes → revert restores originals on IDA) andtest_patch_get_and_list(IDA).setverified in memory. angr:setcorrectly rejected.Support matrix
Seventh PR in the IDALib-parity series. Based on
feat/cli-define-undefine(#209).🤖 Generated with Claude Code
https://claude.ai/code/session_01HfZHdprXg38re1XyKxzGg5