Skip to content

Restore snapshot iteration to avoid iterator invalidation in type propagation - #25968

Open
trufae wants to merge 1 commit into
masterfrom
codex/fix-iterator-invalidation-in-type-propagation
Open

Restore snapshot iteration to avoid iterator invalidation in type propagation#25968
trufae wants to merge 1 commit into
masterfrom
codex/fix-iterator-invalidation-in-type-propagation

Conversation

@trufae

@trufae trufae commented May 15, 2026

Copy link
Copy Markdown
Collaborator

Motivation

  • Fix a high-severity iterator invalidation in register-argument type propagation where iterating directly over &fcn->vars could be mutated by var_retype() -> r_anal_var_set_type() -> shadow_var_struct_members(), causing out-of-bounds access or crashes.

Description

  • Replace the unsafe R_VEC_FOREACH(&fcn->vars, ...) with a stable snapshot obtained via r_anal_var_vec(anal, fcn, R_ANAL_VAR_KIND_REG), iterate over that snapshot, and free it after use, removing the now-unnecessary in-loop kind check.

Testing

  • Attempted a local build with make -j but it failed in this environment due to a missing libr/config.mk, so a full build/test run could not be performed here.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant