From 70ebc1759a21dbe9480ffa3f4b08a4d5aed462cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 13 Sep 2026 00:51:29 +0300 Subject: [PATCH] refactor(ec-opus): bits2pulses row-window bound becomes a debug_assert (reviewer P3) - statically decidable from the unchanged CACHE_BITS table; the fixed-window copy still panics if the table ever outgrew it --- crates/ec-opus/src/celt.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/ec-opus/src/celt.rs b/crates/ec-opus/src/celt.rs index de3308d2..2ad87710 100644 --- a/crates/ec-opus/src/celt.rs +++ b/crates/ec-opus/src/celt.rs @@ -2750,7 +2750,9 @@ const CACHE_ROW_MAX: usize = 64; pub(crate) fn bits2pulses(band: usize, lm: i32, bits: i32) -> i32 { let base = cache_index(band, lm); let count = CACHE_BITS[base] as usize; - assert!( + // Statically decidable from the unchanged CACHE_BITS table (reviewer P3); + // the copy below still panics if the table ever outgrew the window. + debug_assert!( count < CACHE_ROW_MAX, "CACHE_BITS row overflows the fixed window" );