From patchwork Sat Jul 28 12:32:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 9831 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp1885911jad; Sat, 28 Jul 2018 05:33:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcTbkSb5bCn6AS7T/lZAb77i/hkFFOwp/tvryzc0ydjFaaNivHvDcvAlguNxpn+J//5g/y+ X-Received: by 2002:adf:ff11:: with SMTP id k17-v6mr9019572wrr.255.1532781202372; Sat, 28 Jul 2018 05:33:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532781202; cv=none; d=google.com; s=arc-20160816; b=GQz5OkgSJC2Q6LGZq78aBKlHndH3vHbLmX57qrY6j9Siz07ZS6aZ/TrqIlK72yD3yG GVeXujnT7Womt6El6CV0FIC+6ZjxQLWhohuDWP3GsjH5+4YDzgZxdG8HarKtAsnai5hs 43vj4lIT7jMIOQO/jm4auOSOzN2Cd+HqPT6DzwGygFpU0what/Gl5D3/I9VJM4XZlkDC xxn2C5O6jqxPIa7s6KiQgFFZSdO8B9qiEgKvGqfc0rm4v2YoDehVYHSIqoEuNngmj1nt 8QnKQ7FJUjJyoIuFi/q6kvda7pz9AeXLTuvyVqgo6aFbwIPqASpSuc4drhgru2LC9pdW H52A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=RSTf6G71qCdBjFqqPixRy2UIW5mXR/FVM0Hb6NvRb5U=; b=DE/uCIdDWpdeWqGhXa31QuHUBPB9gvn5W1AHuI3CdiAX1i9afmnrYZqJoMEEHEp+Wk W9sBd5fFl4YyDAOOf6O01r7SpBESO+yrPEEqCKMXfYKi8kS9idSjVakGK6bk46J+yDU/ sk4ky1Gadzrd1zj/Hup1TheLBhknKOFTEH7lojRqLvRdE1YCV3zjBNMoDxp8T9/IE/fF ZmVpnmSGYbA78mj3+YYg7xKb9/qkIa5QDe9kAuxn7G9chHlP3b4ceDip9oWGkCrelUnH ap83stp+7TEhufemP9VNwUgUEzlD7bHBaIn9C5/NsX2LcOwyAI9S4+njxXPdI7Nqg7cm hpYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 196-v6si5816641wmu.166.2018.07.28.05.33.21; Sat, 28 Jul 2018 05:33:22 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5860268A4F1; Sat, 28 Jul 2018 15:32:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe08-3.mx.upcmail.net (vie01a-dmta-pe08-3.mx.upcmail.net [84.116.36.22]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 61BB168825E for ; Sat, 28 Jul 2018 15:32:50 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe08.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fjOPB-0004v4-RH for ffmpeg-devel@ffmpeg.org; Sat, 28 Jul 2018 14:33:05 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id GCYw1y0120S5wYM01CYx2L; Sat, 28 Jul 2018 14:32:57 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 28 Jul 2018 14:32:30 +0200 Message-Id: <20180728123232.6191-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180728123232.6191-1-michael@niedermayer.cc> References: <20180728123232.6191-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/4] avcodec/aacdec_template: Check for duplicate elements X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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 --- 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);