Fix decompiler crash on stack-returned values in c_return_as_atoms#27
Open
vietd0x wants to merge 1 commit into
Open
Fix decompiler crash on stack-returned values in c_return_as_atoms#27vietd0x wants to merge 1 commit into
vietd0x wants to merge 1 commit into
Conversation
c_return_as_atoms called Atom.from_argument without a stack pointer, so any callee whose return value mapped to a SimStackArg raised "You must provide a stack pointer to translate a SimStackArg". Under the decompiler's resilience mode this silently aborted decompilation, leaving codegen=None. Mirror the existing c_args_as_atoms handling: resolve sp from the state and skip stack args that can't be translated. Register-returned values (the common case) are unaffected since SimRegArg ignores sp. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Collaborator
|
Hi, Thanks for summitting this PR! Could you please move it to angr/angr instead? Oxidizer has already been merged into angr and this repo is supposed to be archieved. Best |
Collaborator
|
@bluesadi You probably want to make it clear in README.md :) |
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.
Summary
FunctionHandler.c_return_as_atomscallsAtom.from_argument(...)without a stack pointer. When a callee's recovered return value maps to aSimStackArg(e.g. a value returned on the stack),Atom.from_argumentraises:This propagates out of the
ReachingDefinitionsAnalysis(invoked viaCompleteCallingConventions/ the decompiler). Under the decompiler's resilience mode the exception is swallowed, decompilation aborts, andDecompiler.codegenends upNone— so the function silently fails to decompile.The sibling helper
c_args_as_atomsalready handles this correctly: it resolvesspfrom the state and wraps the call intry/except ValueError: continue. This PR makesc_return_as_atomsconsistent with it.Root cause
c_return_as_atoms(inangr/analyses/reaching_definitions/function_handler.py):Fix
Resolve
spfrom the state and skip footprint args that can't be translated, mirroringc_args_as_atoms:Behavior impact
SimRegArgignoressp, and noValueErroris raised, so output is identical.MemoryLocationatom whenspis resolvable, or are skipped gracefully when it isn't — exactly the strategyc_args_as_atomsalready uses for arguments.Test plan
codegen=Nonewith two swallowedSimStackArgValueErrors;fail_fast=Truepinpointed the call site atc_return_as_atoms.🤖 Generated with Claude Code