[FFmpeg-cvslog] avfilter/af_alimiter: Check nextpos before use
Michael Niedermayer
git at videolan.org
Sun Apr 14 20:33:51 EEST 2024
ffmpeg | branch: release/5.1 | Michael Niedermayer <michael at niedermayer.cc> | Fri Dec 22 21:49:48 2023 +0100| [4e9f83c65a79fb11a7467ebe2eeea7bcb0a9fbb8] | 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=4e9f83c65a79fb11a7467ebe2eeea7bcb0a9fbb8
---
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 622dc66324..906d329577 100644
--- a/libavfilter/af_alimiter.c
+++ b/libavfilter/af_alimiter.c
@@ -194,10 +194,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