aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-09-24 22:20:39 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:37:20 +0200
commit91f7983a8959b6c5d14eed21bb575ecd88065bd9 (patch)
tree416d5aeea01f5fa6a0013ade56f9565bc4c59ba2
parentb81d1379c296de48ebcc7ead0b3f22a4265b0ea1 (diff)
downloadffmpeg-91f7983a8959b6c5d14eed21bb575ecd88065bd9.tar.gz
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@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit f249981976b18438cfb646183d4c21fb051e1ad4) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/sonic.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
index f1bc3409bf..ad1552a434 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]);
}