log_mel_spectrogram() (src/whisper.cpp) applies reflective padding by reverse-copying stage_2_pad samples from the start of the input:
std::reverse_copy(samples + 1, samples + 1 + stage_2_pad, ...) // stage_2_pad = 200
When the input has fewer than 201 samples (e.g. 4 float32 samples / 16 bytes), the source range extends up to ~784 bytes past the end of the sample buffer — a heap out-of-bounds read (CWE-125).
Reachability: any path that feeds short user-supplied audio to whisper_full() (e.g. a transcription API).
Reproduction: a 16-byte input (4 float32 samples) passed to whisper_full() triggers the read under AddressSanitizer. Confirmed on commit 95ea8f9b (v1.8.4-58), x86_64. Minimal PoC available on request.
Suggested fix: reject or clamp when n_samples < stage_2_pad + 1 (bound the reflective-pad source to the available samples).
log_mel_spectrogram()(src/whisper.cpp) applies reflective padding by reverse-copyingstage_2_padsamples from the start of the input:When the input has fewer than 201 samples (e.g. 4 float32 samples / 16 bytes), the source range extends up to ~784 bytes past the end of the sample buffer — a heap out-of-bounds read (CWE-125).
Reachability: any path that feeds short user-supplied audio to
whisper_full()(e.g. a transcription API).Reproduction: a 16-byte input (4 float32 samples) passed to
whisper_full()triggers the read under AddressSanitizer. Confirmed on commit95ea8f9b(v1.8.4-58), x86_64. Minimal PoC available on request.Suggested fix: reject or clamp when
n_samples < stage_2_pad + 1(bound the reflective-pad source to the available samples).