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
fix: regex panic on hunk headers without line count #159
cora review panics with no group at index '4' when parsing diff hunk headers that omit line counts (e.g., @@ -1 +1 @@).
Evidence
thread 'main' (517534) panicked at regex-1.12.3/src/regex/string.rs:2024:32:
no group at index '4'
zsh: abort RUST_BACKTRACE=1 cora review --base origin/develop
Trigger:cora review --base origin/develop
Root Cause
src/engine/diff_parser.rs lines 128-130 — direct indexing caps[N] on optional capture groups.
staticRE_HUNK_HEADER:LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"^@@\s-(\d+)(?:,(\d+))?\s\+(\d+)(?:,(\d+))?\s@@\s?(.*)").unwrap());// PANICS when optional group 2 or 4 didn't participate in matchlet old_count:u32 = caps[2].parse().unwrap_or(1);// line 128let new_count:u32 = caps[4].parse().unwrap_or(1);// line 130
Groups (?:,(\d+))? are optional. When git outputs @@ -1 +1 @@ (no ,1), groups 2 and 4 don't participate. Direct caps[N] indexing on non-participating groups panics in the regex crate.
Fix
Use .get(N) for optional groups:
let old_count:u32 = caps.get(2).and_then(|m| m.as_str().parse().ok()).unwrap_or(1);let new_count:u32 = caps.get(4).and_then(|m| m.as_str().parse().ok()).unwrap_or(1);
Impact
Blocks all PRs — Cora Review is a required CI check
Affects any diff with single-line hunks (very common)
changed the title [-]fix: Cora Review CI crash (SIGABRT exit 134) on self-review[/-][+]fix: regex panic on hunk headers without line count[/+]on Jun 5, 2026
Activity
[-]fix: Cora Review CI crash (SIGABRT exit 134) on self-review[/-][+]fix: regex panic on hunk headers without line count[/+]fix: regex panic on optional hunk groups + raise max diff to 5MB
fix: regex panic on optional hunk groups + raise max diff to 5MB
feat(website): landing page redesign — CSS, components, animations (#171