fix(tools/reversing): correct Ghidra recon script entry-point handling#395
Closed
VoidChecksum wants to merge 1 commit into
Closed
fix(tools/reversing): correct Ghidra recon script entry-point handling#395VoidChecksum wants to merge 1 commit into
VoidChecksum wants to merge 1 commit into
Conversation
Remove the broken `addrs = [str(a) for a in f.getEntryPoint()]` line in _GHIDRA_RECON: Address is not iterable in Jython, causing TypeError on the first real function visit and aborting the recon script before any output. The variable was also never used. getEntryPoint() is already printed correctly on the next line. Regression test: test_ghidra_script_entrypoint.py asserts the broken iteration and unused addrs variable are absent, and that getEntryPoint() appears exactly once per the correct print statement.
VoidChecksum
added a commit
that referenced
this pull request
May 30, 2026
…cript Folds in the crash fix from #395: the Ghidra recon template iterated 'for a in f.getEntryPoint()', but Function.getEntryPoint() returns a single non-iterable Address, so the generated script raised at runtime. The line was also dead (addrs unused). Removes it; the entry point is still printed. Adds a regression test. Consolidates #395 into this PR.
Collaborator
Author
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.
Defect
_GHIDRA_RECON(inscripts.pyline 35) contained:Function.getEntryPoint()returns a singleghidra.program.model.address.Addressobject, which is not iterable. In Jython this raisesTypeError: 'GenericAddress' object is not iterablethe first time a real (non-thunk, non-external) function is visited, aborting the entire generated recon script before it can print any function list or imports.The
addrsvariable was also never referenced anywhere else, making the line purely dead-then-crash code.Impact
The
bin_ghidra_script@toolemits this script body for the agent to write to disk and execute viaanalyzeHeadless. Any RE workflow invoking the standard Ghidra recon script produces a runtime crash with no function output.Fix
Deleted the broken unused line.
getEntryPoint()is already printed correctly on the immediately followingprint(...)line — no functional change needed, just removal.Regression Test
packages/decepticon/tests/unit/reversing/test_ghidra_script_entrypoint.py— 4 new assertions:test_no_iterable_getentrypoint: asserts the brokenfor a in f.getEntryPoint()pattern is absent (FAIL without fix, PASS with fix)test_addrs_variable_absent: assertsaddrsis not in the generated script (FAIL without fix, PASS with fix)test_entrypoint_printed_once: assertsgetEntryPoint()appears exactly once — the correct print call (FAIL without fix due to duplicate, PASS with fix)test_binary_path_substituted: sanity-checks binary path substitution works