[FFmpeg-cvslog] avcodec/aacdec_template: Check for duplicate elements

Michael Niedermayer git at videolan.org
Sat Aug 4 17:18:08 EEST 2018


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Jul 28 11:42:37 2018 +0200| [40c2f870aec923894692752718193404151b17b2] | committer: Michael Niedermayer

avcodec/aacdec_template: Check for duplicate elements

Fixes: Timeout
Fixes: 9552/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-6027842339995648

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

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

 libavcodec/aacdec_template.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index 0c899285dd..b60b31a92c 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -3122,6 +3122,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
     int samples = 0, multiplier, audio_found = 0, pce_found = 0;
     int is_dmono, sce_count = 0;
     int payload_alignment;
+    uint8_t che_presence[4][MAX_ELEM_ID] = {{0}};
 
     ac->frame = data;
 
@@ -3159,6 +3160,14 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
         }
 
         if (elem_type < TYPE_DSE) {
+            if (che_presence[elem_type][elem_id]) {
+                av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d duplicate\n",
+                       elem_type, elem_id);
+                err = AVERROR_INVALIDDATA;
+                goto fail;
+            }
+            che_presence[elem_type][elem_id] = 1;
+
             if (!(che=get_che(ac, elem_type, elem_id))) {
                 av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n",
                        elem_type, elem_id);



More information about the ffmpeg-cvslog mailing list