mirror of
https://github.com/securego/gosec.git
synced 2026-06-20 00:15:59 +02:00
Summary: This change fixes the hang/perceived hang reported in issue #1555 when scanning large codebases with complex SSA graphs. The fix is intentionally scoped to G120 form parsing analysis only. Root cause: G120 wrapper/middleware protection logic repeatedly called value-dependency checks across many function/call combinations. The dependency traversal was depth-limited but not memoized, so cyclic and branch-heavy SSA structures (especially Phi-related paths) caused repeated re-traversal of the same graph regions and severe runtime blowup. What changed: A cycle-safe, memoized dependency checker was added and used only inside the G120 form parsing analysis flow. Existing G120 logic was kept semantically equivalent while replacing repeated raw dependency traversals with cached checks. Focused regression tests were added for cyclic Phi graphs to verify both cases: no target reachable (false) and target reachable (true), including stable repeated evaluation. Signed-off-by: Cosmin Cojocar <cosmin@cojocar.ch>