You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
Closes the **UnboundedAllocation** slice of the [panic-attack Track-C
triage (#104)](#104) — 8
Critical findings, all sharing one root cause.
## Root cause
Raw \`std::fs::read_to_string(path)\` with no size cap. A pathological
file (\`/dev/zero\`, a corrupted \`.agda\` corpus entry, a
maliciously-large \`synonyms.toml\`) could OOM the process.
## Fix
Add \`bounded_read_corpus_file\` (sync) to \`src/rust/provers/io.rs\`,
mirroring the existing async \`bounded_read_proof_file\`:
- Same 64 MiB cap (\`MAX_PROOF_BYTES\`)
- Same \`Read::take(N+1)\` discipline (no TOCTOU race vs
\`metadata().len()\`)
- Same error-not-truncate semantics
- 3 new unit tests (small / oversized / missing-file)
Swap the 8 call sites to route through the helper:
| File | Original line | What it reads |
|---|---|---|
| \`src/rust/corpus/agda.rs\` | 55 | per-\`*.agda\` corpus entry |
| \`src/rust/corpus/coq.rs\` | 49 | per-\`*.v\` corpus entry |
| \`src/rust/corpus/mod.rs\` | 225 | \`Corpus::load_json\` snapshot |
| \`src/rust/suggest/synonyms.rs\` | 56 | synonym-table TOML |
| \`src/rust/suggest/extractor.rs\` | 66 | lemma-extraction probe |
| \`src/rust/diagnostics/corpus_monitor.rs\` | 89 | periodic
premises.jsonl |
| \`src/rust/diagnostics/gnn_training.rs\` | 28 | GNN metrics JSON |
## False-positive documented
\`src/rust/corpus/octad.rs:361\` — \`String::with_capacity(bytes.len() *
2)\` is statically bounded. Every caller passes \`Sha256::finalize()\`
output (32 bytes ⇒ 64-char hex string). Annotated inline so future
static analysis can treat it as proven-bounded; no code change.
## Test plan
- [x] \`cargo test --lib provers::io\` — 5/5 pass (2 async + 3 new sync)
- [x] \`cargo test --lib corpus\` — 53/53 pass (no regression)
- [x] \`cargo test --lib suggest\` — 49/49 pass (no regression)
- [x] \`cargo test --lib diagnostics\` — 36/36 pass (no regression)
- [x] \`cargo clippy --lib\` — 0 warnings
## Out of scope
- PA001/PA007 UnsafeCode/UnsafeFFI findings — separate panic-attack rule
families
- Findings already suppressed in \`audits/assail-classifications.a2ml\`
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments