From patchwork Mon Aug 21 00:15:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 4780 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.37.132 with SMTP id g126csp2385309jag; Sun, 20 Aug 2017 17:16:05 -0700 (PDT) X-Received: by 10.28.92.14 with SMTP id q14mr4931463wmb.144.1503274565171; Sun, 20 Aug 2017 17:16:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503274565; cv=none; d=google.com; s=arc-20160816; b=jGpE+C/71V3Rzy6CKs+T0O5C0xD8Y1ESkT+0Zifll/iSL/UCu/bCJFY/XPQ3LTuMDU ttGU0qfsFYRQZjtQl539gC0suT/dL4WkpRZFW5JzZtyew6Rt5FlpUmwQa+pdfqEs3aYX hVw0SIrnZ1GabClaMOCIKsaoGyR9b4Ury3rOC7AwvUD9oX1xgMqOS7iT0X+f+Q2LH0Lr IBF9tJohTs8qyjtNOaxoM9TjeomurcnwXpyU2e+Gt71LyTGyrTZcbnQt3eZo2PR5F3SD jbHDZKVwlHUqK/rFjm3UTSo/XP3JtfhHOewsKssBn9v6YonZadFcHm92Sff5AsMj89BH vIKQ== 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:message-id:date:to:from:delivered-to :arc-authentication-results; bh=CNvB7XoweNPiw6gCq+ngW3Ppkk+0D09RUzljzxqYFus=; b=q2gfLmroMckw6Ai9ZC+WDR7hobJF191HEQVpJYdht4kPEcTrHu1102+MlPs4JoVDxv Vv8mXaYMGg+yZ9hVYO+LhbOjOIkVneSFT514BbitLFwRY6xHtEc34AINE9mI88clTV+Z 5Wpnn4UHiivjLv+TA1GSxSxee3bikvlyCg061i+oWjN/avc7uoxNj1TJnR02SFOoh+fu 2Hm1ODE7LUcRwqpWmKC1q8L7BTPRBlhK83sc1zSbZA2rWEQLYSt56gSCqBtuekDEC1cZ HaMyAq0GmJdcXpV2LNWumxH7q0wZ8RuGAMZrEm7xDpcKdgJMLQk61ZQK50OMUEIIzUyT 3D1Q== 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 l33si8353102wrl.217.2017.08.20.17.16.04; Sun, 20 Aug 2017 17:16:05 -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 4DB95689889; Mon, 21 Aug 2017 03:15:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe04-3.mx.upcmail.net (vie01a-dmta-pe04-3.mx.upcmail.net [62.179.121.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E8CBA6891FB for ; Mon, 21 Aug 2017 03:15:47 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe04.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1djaNm-0008Vd-1o for ffmpeg-devel@ffmpeg.org; Mon, 21 Aug 2017 02:15:54 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id zcFq1v01K0S5wYM01cFrGR; Mon, 21 Aug 2017 02:15:52 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 21 Aug 2017 02:15:49 +0200 Message-Id: <20170821001550.10803-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.14.1 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/aacdec_template: Fix running cleanup in decode_ics_info() 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: out of array read Fixes: 2873/clusterfuzz-testcase-minimized-5924145713905664 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/aacdec_template.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index a539f74e6f..e7fa27e8db 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -1332,7 +1332,7 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics, ics->tns_max_bands = ff_tns_max_bands_512[sampling_index]; } if (!ics->num_swb || !ics->swb_offset) - return AVERROR_BUG; + goto fail; } else { ics->swb_offset = ff_swb_offset_1024[sampling_index]; ics->num_swb = ff_aac_num_swb_1024[sampling_index]; @@ -1356,7 +1356,7 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics, if (aot == AOT_ER_AAC_LD) { av_log(ac->avctx, AV_LOG_ERROR, "LTP in ER AAC LD not yet implemented.\n"); - return AVERROR_PATCHWELCOME; + goto fail; } if ((ics->ltp.present = get_bits(gb, 1))) decode_ltp(&ics->ltp, gb, ics->max_sfb);