B&W print-friendly diagrams + tinkerpop-0001 + wave-3 proof sections. Squash of 94 local commits onto remote master.
1.2 KiB
1.2 KiB
| id | repo | severity | status | created | patched | patch |
|---|---|---|---|---|---|---|
| ghc-0001 | ghc | HIGH | PATCHED | 2026-03-23 | 2026-03-23 | defects/ghc/patch/ghc-cwe407-set-membership.patch |
Defect
File: compiler/GHC/Data/Graph/Directed/Internal.hs:78
Pattern: v `elem` adjacency_list in SCC decode
Complexity: O(V×degree)
Language: Haskell
Description
During SCC decoding, GHC checks edge membership using elem on an adjacency list represented as a plain Haskell list. For each vertex V being decoded, every neighbor lookup scans up to degree entries linearly. With V vertices each having up to degree neighbors, the aggregate cost across the full SCC decode is O(V×degree), which degrades to O(V²) for dense graphs.
Fix
Replace: v `elem` adjacency_list
With: v `S.member` adjacency_set
Data structure change: adjacency_list: [Vertex] → adjacency_set: Set Vertex
Work required
- Patch in
defects/ghc/patch/ - Unit test — asserts exact operation counts before/after (in
defects/ghc/unit/) - Integration test (in
defects/ghc/integration/) - Benchmark — before/after on V=100,200,400,800 (in
defects/ghc/bench/) - White paper section