From patchwork Tue Sep 8 21:29:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 22200 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 9691044BD8E for ; Wed, 9 Sep 2020 00:30:36 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 77AEA68B6EB; Wed, 9 Sep 2020 00:30:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-3.mx.upcmail.net (vie01a-dmta-pe03-3.mx.upcmail.net [62.179.121.162]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8988B68B5C8 for ; Wed, 9 Sep 2020 00:30:29 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1kFlC9-0000kl-0L for ffmpeg-devel@ffmpeg.org; Tue, 08 Sep 2020 23:30:29 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id FlBBkAVs2Ir7GFlBBkuNJ5; Tue, 08 Sep 2020 23:29:29 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=QN4WuTDL c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=nZOtpAppAAAA:20 a=w7zGU-d6DbOsiOROoRcA:9 a=1fhp2MxaeJtTNGEnv6mo:22 a=Z5ABNNGmrOfJ6cZ5bIyy:22 a=SsAZrZ5W_gNWK9tOzrEV:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 8 Sep 2020 23:29:19 +0200 Message-Id: <20200908212921.7408-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200908212921.7408-1-michael@niedermayer.cc> References: <20200908212921.7408-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfD+ylpfvfm1zPsNJ5zlHoPD7q5jnVbkLHr9PkyztFDDgpx4J7oKe7UgQhdV5gul/WzWkgJpBXxux6EJVG/ZdU95uD+48uPdt+DXmtCL+Y0braxtxHfEk 5ahehHBx2Rw22UqACnt2KYbEqWwI38kQKgLcv3INIfpTLY/odiLPTzLq Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/fastaudio: Check channels 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: division by 0 Fixes: 25419/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FASTAUDIO_fuzzer-5632544761184256 Fixes: 25433/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FASTAUDIO_fuzzer-6215671900536832 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/fastaudio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/fastaudio.c b/libavcodec/fastaudio.c index de006acd9b..34857d1b88 100644 --- a/libavcodec/fastaudio.c +++ b/libavcodec/fastaudio.c @@ -41,6 +41,9 @@ static av_cold int fastaudio_init(AVCodecContext *avctx) { FastAudioContext *s = avctx->priv_data; + if (avctx->channels <= 0) + return AVERROR_INVALIDDATA; + avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; for (int i = 0; i < 8; i++) From patchwork Tue Sep 8 21:29:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 22201 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id D8DAC44BD8E for ; Wed, 9 Sep 2020 00:30:37 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B8C1F68B6D7; Wed, 9 Sep 2020 00:30:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-3.mx.upcmail.net (vie01a-dmta-pe03-3.mx.upcmail.net [62.179.121.162]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8C3EC68B6A3 for ; Wed, 9 Sep 2020 00:30:29 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1kFlC9-0004pd-0M for ffmpeg-devel@ffmpeg.org; Tue, 08 Sep 2020 23:30:29 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id FlBBkAVsOIr7GFlBBkuNJF; Tue, 08 Sep 2020 23:29:29 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=QN4WuTDL c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=F3ZyOR7hIl-MsCahud4A:9 a=pHzHmUro8NiASowvMSCR:22 a=Ew2E2A-JSTLzCXPT_086:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 8 Sep 2020 23:29:20 +0200 Message-Id: <20200908212921.7408-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200908212921.7408-1-michael@niedermayer.cc> References: <20200908212921.7408-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfD+ylpfvfm1zPsNJ5zlHoPD7q5jnVbkLHr9PkyztFDDgpx4J7oKe7UgQhdV5gul/WzWkgJpBXxux6EJVG/ZdU95uD+48uPdt+DXmtCL+Y0braxtxHfEk 5ahehHBx2Rw22UqACnt2KYbEqWwI38kQKgLcv3INIfpTLY/odiLPTzLq Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/fastaudio: Remove redundant % 32 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" Signed-off-by: Michael Niedermayer --- libavcodec/fastaudio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/fastaudio.c b/libavcodec/fastaudio.c index 34857d1b88..16f44790f5 100644 --- a/libavcodec/fastaudio.c +++ b/libavcodec/fastaudio.c @@ -95,7 +95,7 @@ static int read_bits(int bits, int *ppos, unsigned *src) r = src[(pos - 1) / 32] >> (32 - pos % 32); *ppos = pos; - return r & ((1 << (bits % 32)) - 1); + return r & ((1 << bits) - 1); } static const uint8_t bits[8] = { 6, 6, 5, 5, 4, 0, 3, 3, }; From patchwork Tue Sep 8 21:29:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 22202 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 4E5DE449327 for ; Wed, 9 Sep 2020 00:36:15 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 320F568B6D0; Wed, 9 Sep 2020 00:36:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe06-3.mx.upcmail.net (vie01a-dmta-pe06-3.mx.upcmail.net [84.116.36.16]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ED95468B610 for ; Wed, 9 Sep 2020 00:36:08 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe06.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1kFlC9-0003YU-0N for ffmpeg-devel@ffmpeg.org; Tue, 08 Sep 2020 23:30:29 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id FlBBkAVsuIr7GFlBBkuNJP; Tue, 08 Sep 2020 23:29:29 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=QN4WuTDL c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=nZOtpAppAAAA:20 a=jKsKEQ2Ia1XFwtk5B3oA:9 a=1fhp2MxaeJtTNGEnv6mo:22 a=Z5ABNNGmrOfJ6cZ5bIyy:22 a=SsAZrZ5W_gNWK9tOzrEV:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 8 Sep 2020 23:29:21 +0200 Message-Id: <20200908212921.7408-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200908212921.7408-1-michael@niedermayer.cc> References: <20200908212921.7408-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfD+ylpfvfm1zPsNJ5zlHoPD7q5jnVbkLHr9PkyztFDDgpx4J7oKe7UgQhdV5gul/WzWkgJpBXxux6EJVG/ZdU95uD+48uPdt+DXmtCL+Y0braxtxHfEk 5ahehHBx2Rw22UqACnt2KYbEqWwI38kQKgLcv3INIfpTLY/odiLPTzLq Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/fastaudio: Fix invalid shift exponent 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: shift exponent 32 is too large for 32-bit type 'unsigned int' Fixes: 25434/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FASTAUDIO_fuzzer-6252363168612352 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/fastaudio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/fastaudio.c b/libavcodec/fastaudio.c index 16f44790f5..e37d4f8425 100644 --- a/libavcodec/fastaudio.c +++ b/libavcodec/fastaudio.c @@ -92,7 +92,7 @@ static int read_bits(int bits, int *ppos, unsigned *src) pos = *ppos; pos += bits; - r = src[(pos - 1) / 32] >> (32 - pos % 32); + r = src[(pos - 1) / 32] >> ((-pos) & 31); *ppos = pos; return r & ((1 << bits) - 1);