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
This commit is contained in:
llyyr authored and Dudemanguy committed 2026-06-17 13:37:34 +00:00
1 parent 9d828d5e55
commit 4acaa77de5
1 file changed
+4 -3
+4 -3
View File
@@ -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;