Commit f6bb2cd1 authored by Michael Niedermayer's avatar Michael Niedermayer

swresample/resample: fix invert_initial_buffer() after flush

Fixes: asan_heap-uaf_2071250_7_139.ogg
Fixes: assertion failure
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 080c846f
......@@ -399,11 +399,11 @@ static int invert_initial_buffer(ResampleContext *c, AudioData *dst, const Audio
res = num - *out_sz;
*out_idx = c->filter_length + (c->index >> c->phase_shift);
*out_sz = 1 + c->filter_length * 2 - *out_idx;
*out_sz = FFMAX(*out_sz + c->filter_length,
1 + c->filter_length * 2) - *out_idx;
c->index &= c->phase_mask;
av_assert1(res > 0);
return res;
return FFMAX(res, 0);
}
struct Resampler const swri_resampler={
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment