From 4acaa77de57af6856e0b1583ce7e48cae4377e50 Mon Sep 17 00:00:00 2001 From: llyyr Date: Wed, 10 Jun 2026 22:57:26 +0530 Subject: [PATCH] af_scaletempo: avoid memcpy with disabled overlap Overlap can be disabled with overlap=0 or very small stride values which cause calculated overlap size to truncate down to 0. Fixes: https://github.com/mpv-player/mpv/issues/18107 --- audio/filter/af_scaletempo.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/audio/filter/af_scaletempo.c b/audio/filter/af_scaletempo.c index 060a5b08a9..f37e9b7d5a 100644 --- a/audio/filter/af_scaletempo.c +++ b/audio/filter/af_scaletempo.c @@ -389,9 +389,10 @@ static void af_scaletempo_process(struct mp_filter *f) out_offset += s->bytes_stride; // input stride - memcpy(s->buf_overlap, - s->buf_queue + bytes_off + s->bytes_stride, - s->bytes_overlap); + if (s->buf_overlap && s->bytes_overlap) + memcpy(s->buf_overlap, + s->buf_queue + bytes_off + s->bytes_stride, + s->bytes_overlap); tf = s->frames_stride_scaled + s->frames_stride_error; ti = (int)tf; s->frames_stride_error = tf - ti;