]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commit
vad : fix buffer overflow in sample reduction loop (#3558)
authorJoseph Sellers <redacted>
Sat, 6 Dec 2025 11:28:32 +0000 (11:28 +0000)
committerGitHub <redacted>
Sat, 6 Dec 2025 11:28:32 +0000 (12:28 +0100)
commita88b93f85f08fc6045e5d8a8c3f94b7be0ac8bce
tree6cff463496b2ed650a3df2cb0dda68bfce7f3175
parentd566358a1d339b471dc113303d008441f2abcc39
vad : fix buffer overflow in sample reduction loop (#3558)

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
src/whisper.cpp