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
{{ message }}
Repository navigation
Replace expect() in shipped hot paths (parser.rs ×157, string.rs, measure_depth.rs) — CWE-754 #94
Hypatia code_safety/expect_in_hot_path (CWE-754) on PR #92 (pre-existing; advisory flag, non-blocking):
File
Occurrences
crates/my-lang/src/parser.rs
157
crates/my-lang/examples/measure_depth.rs
2
crates/my-lang/lib/common/string.rs
1
expect() on a hot path panics on malformed input instead of returning a recoverable error. The parser is the worst offender (157) and is exactly where untrusted input lands.
Action
Convert hot-path expect() to Result-returning error handling (or document a genuine invariant where panicking is correct, and exempt that site in .hypatia-ignore with rationale).
Prioritise parser.rs.
Tracked in STATE.a2ml [blockers-and-issues] expect-hot-path.
#145 covers the same three sites (parser.rs ×157, string.rs ×1, measure_depth.rs ×2) plus the unwrap_without_check debt this issue didn't cover (my-fmt ×26, my-llvm ×3, my-mir ×5), and it is the issue referenced by all 7 entries of .hypatia-baseline.json (PR #146) — so the baseline's expiry (2026-10-27) and this debt now track in one place.
One correction carried over from the triage: the parser.rs ×157 count is a scanner false positive by name collision. Those hits are the parser's own self.expect(TokenKind) -> Result<...> method, not Option/Result::expect panics — grep for \.expect(" returns nothing in that file. So the "worst offender / exactly where untrusted input lands" framing here does not hold; the parser already returns recoverable errors. An upstream hypatia rule fix (disambiguate method-call expect from the panicking one) is the real action.
Activity
docs(checkpoint): refresh STATE/META/README; record ADRs; fix stale m…
proof(solo-core): CBV semantics + progress (F1.1, F1.3); Echo in the …
hyperpolymath commentedon Jul 29, 2026
Consolidated into #145 — closing as duplicate.
#145 covers the same three sites (
parser.rs×157,string.rs×1,measure_depth.rs×2) plus theunwrap_without_checkdebt this issue didn't cover (my-fmt ×26, my-llvm ×3, my-mir ×5), and it is the issue referenced by all 7 entries of.hypatia-baseline.json(PR #146) — so the baseline's expiry (2026-10-27) and this debt now track in one place.One correction carried over from the triage: the
parser.rs×157 count is a scanner false positive by name collision. Those hits are the parser's ownself.expect(TokenKind) -> Result<...>method, notOption/Result::expectpanics — grep for\.expect("returns nothing in that file. So the "worst offender / exactly where untrusted input lands" framing here does not hold; the parser already returns recoverable errors. An upstream hypatia rule fix (disambiguate method-callexpectfrom the panicking one) is the real action.Genuine remaining debt is enumerated in #145.