[FFmpeg-cvslog] avcodec/sonic: Check channels before deallocating

Michael Niedermayer git at videolan.org
Fri Sep 25 17:37:33 EEST 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Sep 24 22:20:39 2020 +0200| [f249981976b18438cfb646183d4c21fb051e1ad4] | committer: Michael Niedermayer

avcodec/sonic: Check channels before deallocating

Fixes: heap-buffer-overflow
Fixes: 25744/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5172961169113088

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f249981976b18438cfb646183d4c21fb051e1ad4
---

 libavcodec/sonic.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
index fa4ecc3a7a..e1d37f8780 100644
--- a/libavcodec/sonic.c
+++ b/libavcodec/sonic.c
@@ -980,9 +980,7 @@ static av_cold int sonic_decode_close(AVCodecContext *avctx)
     av_freep(&s->int_samples);
     av_freep(&s->tap_quant);
     av_freep(&s->predictor_k);
-
-    for (i = 0; i < s->channels; i++)
-    {
+    for (i = 0; i < MAX_CHANNELS; i++) {
         av_freep(&s->predictor_state[i]);
         av_freep(&s->coded_samples[i]);
     }



More information about the ffmpeg-cvslog mailing list