mirror of
https://github.com/ggml-org/whisper.cpp.git
synced 2026-08-01 15:40:49 -05:00
The buffer size calculation loop (line ~6661) uses `n_samples - 1` as the upper bound for segment_end_samples, but the copy loop (line 6696) uses `n_samples`. This inconsistency allows the copy loop to compute segment_length values up to 1 sample larger per segment than what was allocated, causing heap corruption. Symptom: `malloc(): corrupted top size` or `malloc(): invalid size (unsorted)` crashes after VAD completes sample reduction. Fix: Use consistent bounds (`n_samples - 1`) in both loops. Fixes #3403