Repository navigation
Commit 10617e7
committed
fix(go): expand each node once in _reach, not once per predecessor
Found by evaluating against the analyzer's own real-app corpus.
_reach built each level as a comprehension and updated `seen` afterwards, so
`seen` did not yet contain the level being built: a node with k predecessors
in the current frontier was appended k times and the next level expanded
every copy. The frontier tracked the number of paths rather than the number
of nodes.
The answer was never wrong -- a set cannot hold duplicates, and over 250
memos ports the reachable set is identical at every depth -- so only cost
revealed it. On memos (208,293 source nodes, 743,154 edges): 151,417,783
frontier expansions at depth 8 against 670,450, 83.65s against 0.11s, and
unbounded it did not terminate. depth=None is the default on paths_between,
flows_to_call, flows_to_argument and taint, so the unusable case was the
default one.
After the fix, memos answers in 17s end to end: 11,477 ports swept at a max
of 0.1s each, RSS flat at 3.4 GB, and taint finds 40 paths into
database/sql.DB.QueryContext -- the HTTP-to-SQL-through-an-interface flow that
app is in the corpus for.
Pinned by counting expansions rather than by timing or frontier size: the
committed fixture is too small to blow up, so the test wraps the adjacency and
asserts each node is looked up at most once. It fails on the old walk.
Refs #4361 parent badc527 commit 10617e7
2 files changed
Lines changed: 80 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
730 | 730 | | |
731 | 731 | | |
732 | 732 | | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
733 | 750 | | |
734 | 751 | | |
735 | 752 | | |
736 | 753 | | |
737 | | - | |
738 | | - | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
739 | 760 | | |
740 | 761 | | |
741 | 762 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
382 | 383 | | |
383 | 384 | | |
384 | 385 | | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
385 | 442 | | |
386 | 443 | | |
387 | 444 | | |
| |||
0 commit comments