1
0
Fork 0

avfilter/af_alimiter: Check nextpos before use

Fixes: out of array read
Fixes: tickets/10744/poc11ffmpeg

Found-by: Li Zeyuan and Zeng Yunxiang.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2023-12-22 21:49:48 +01:00
parent 61e73851a3
commit a88b06f9ee
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 4 additions and 3 deletions

View File

@ -195,9 +195,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
int j = i % buffer_size;
double ppeak = 0, pdelta;
for (c = 0; c < channels; c++) {
ppeak = FFMAX(ppeak, fabs(buffer[nextpos[j] + c]));
}
if (nextpos[j] >= 0)
for (c = 0; c < channels; c++) {
ppeak = FFMAX(ppeak, fabs(buffer[nextpos[j] + c]));
}
pdelta = (limit / peak - limit / ppeak) / (((buffer_size - nextpos[j] + s->pos) % buffer_size) / channels);
if (pdelta < nextdelta[j]) {
nextdelta[j] = pdelta;