[FFmpeg-cvslog] avfilter/af_alimiter: Check nextpos before use
Michael Niedermayer
git at videolan.org
Sun Apr 14 23:24:57 EEST 2024
ffmpeg | branch: release/4.2 | Michael Niedermayer <michael at niedermayer.cc> | Fri Dec 22 21:49:48 2023 +0100| [059dfb1a800a8e2fbb9b538444b5d5ed5a81b50e] | committer: Michael Niedermayer
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 at niedermayer.cc>
(cherry picked from commit a88b06f9ee8c88f78bdd614fc25283225223e858)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=059dfb1a800a8e2fbb9b538444b5d5ed5a81b50e
---
libavfilter/af_alimiter.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libavfilter/af_alimiter.c b/libavfilter/af_alimiter.c
index c41e95576f..f941768848 100644
--- a/libavfilter/af_alimiter.c
+++ b/libavfilter/af_alimiter.c
@@ -176,10 +176,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
} else {
for (i = s->nextiter; i < s->nextiter + s->nextlen; i++) {
int j = i % buffer_size;
- double ppeak, pdelta;
+ double ppeak = 0, pdelta;
- ppeak = fabs(buffer[nextpos[j]]) > fabs(buffer[nextpos[j] + 1]) ?
- fabs(buffer[nextpos[j]]) : fabs(buffer[nextpos[j] + 1]);
+ if (nextpos[j] >= 0)
+ ppeak = fabs(buffer[nextpos[j]]) > fabs(buffer[nextpos[j] + 1]) ?
+ fabs(buffer[nextpos[j]]) : fabs(buffer[nextpos[j] + 1]);
pdelta = (limit / peak - limit / ppeak) / (((buffer_size - nextpos[j] + s->pos) % buffer_size) / channels);
if (pdelta < nextdelta[j]) {
nextdelta[j] = pdelta;
More information about the ffmpeg-cvslog
mailing list