PR #25350 opened by romainhedouin URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25350 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25350.patch
The remaining audio is moved to the start of the same buffer. Source and destination overlap when less than half of the buffer was transcribed, and memcpy() does not allow that. Found during a code review sweep of ffmpeg using an LLM. Signed-off-by: romainhedouin <[email protected]> # Summary of changes Briefly describe what this PR does and why. <!-- If this PR requires new FATE test samples, attach them to the PR and list their target paths below (relative to the fate-suite root). Attached filenames must match the sample's filename: ```fate-samples # e.g. vorbis/new-sample.ogg ``` --> >From 36f670e85a5d591c8a732755188b37fa09a7d2b2 Mon Sep 17 00:00:00 2001 From: romainhedouin <[email protected]> Date: Thu, 22 Oct 2026 12:37:39 +0200 Subject: [PATCH] avfilter/af_whisper: use memmove for the overlapping buffer shift The remaining audio is moved to the start of the same buffer. Source and destination overlap when less than half of the buffer was transcribed, and memcpy() does not allow that. Found during a code review sweep of ffmpeg using an LLM. Signed-off-by: romainhedouin <[email protected]> --- libavfilter/af_whisper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/af_whisper.c b/libavfilter/af_whisper.c index 7f41ea1f163..001d492d2ef 100644 --- a/libavfilter/af_whisper.c +++ b/libavfilter/af_whisper.c @@ -330,8 +330,8 @@ static void run_transcription(AVFilterContext *ctx, AVFrame *frame, int samples) av_freep(&segments_text); if (wctx->audio_buffer_fill_size > samples) { - memcpy(wctx->audio_buffer, wctx->audio_buffer + samples, - (wctx->audio_buffer_fill_size - samples) * sizeof(*wctx->audio_buffer)); + memmove(wctx->audio_buffer, wctx->audio_buffer + samples, + (wctx->audio_buffer_fill_size - samples) * sizeof(*wctx->audio_buffer)); wctx->audio_buffer_start_ms += duration * 1000; } wctx->audio_buffer_fill_size -= samples; -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
