From patchwork Thu Feb 6 13:45:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 17700 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 01E2844A41C for ; Thu, 6 Feb 2020 15:52:04 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CA12B68A6E7; Thu, 6 Feb 2020 15:52:03 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe06-2.mx.upcmail.net (vie01a-dmta-pe06-2.mx.upcmail.net [84.116.36.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 92FD568A0FA for ; Thu, 6 Feb 2020 15:51:57 +0200 (EET) 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 1izhUY-0001Vu-0e for ffmpeg-devel@ffmpeg.org; Thu, 06 Feb 2020 14:46:50 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id zhTZikzFRwlyszhTZiqtEZ; Thu, 06 Feb 2020 14:45:50 +0100 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=E5OzWpVl 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=kuTJBYGYT-raagX6xL0A:9 a=1fhp2MxaeJtTNGEnv6mo:22 a=Z5ABNNGmrOfJ6cZ5bIyy:22 a=UDnyf2zBuKT2w-IlGP_r:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 6 Feb 2020 14:45:47 +0100 Message-Id: <20200206134549.29792-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4wfFwA78vCgbOiv+iR/WA4X1DNwiECwNw0srYfdh4cZV8D3Zqk5869y/oqNbVEM1oareqYp5PA6vcKcI9G9UD9xUB4RFdWU20RR0puyFJZ3W9gSeg4mGhQ KYvrpSF9clzo1CQkPqvAGobWMlw76ICal6Zj6LLekL3oirAuRKbFOGNW Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/cavsdsp: Fix invalid left shifts in cavs_idct8_add_c() 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: left shift of negative value -107 Fixes: 20398/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CAVS_fuzzer-5725389278412800 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/cavsdsp.c | 52 ++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/libavcodec/cavsdsp.c b/libavcodec/cavsdsp.c index 90a67e910c..27413b9ee2 100644 --- a/libavcodec/cavsdsp.c +++ b/libavcodec/cavsdsp.c @@ -201,20 +201,20 @@ static void cavs_idct8_add_c(uint8_t *dst, int16_t *block, ptrdiff_t stride) src[0][0] += 8; for( i = 0; i < 8; i++ ) { - const int a0 = 3*src[i][1] - (src[i][7]<<1); - const int a1 = 3*src[i][3] + (src[i][5]<<1); - const int a2 = (src[i][3]<<1) - 3*src[i][5]; - const int a3 = (src[i][1]<<1) + 3*src[i][7]; + const int a0 = 3*src[i][1] - (src[i][7]*2); + const int a1 = 3*src[i][3] + (src[i][5]*2); + const int a2 = (src[i][3]*2) - 3*src[i][5]; + const int a3 = (src[i][1]*2) + 3*src[i][7]; - const int b4 = ((a0 + a1 + a3)<<1) + a1; - const int b5 = ((a0 - a1 + a2)<<1) + a0; - const int b6 = ((a3 - a2 - a1)<<1) + a3; - const int b7 = ((a0 - a2 - a3)<<1) - a2; + const int b4 = ((a0 + a1 + a3)*2) + a1; + const int b5 = ((a0 - a1 + a2)*2) + a0; + const int b6 = ((a3 - a2 - a1)*2) + a3; + const int b7 = ((a0 - a2 - a3)*2) - a2; - const int a7 = (src[i][2]<<2) - 10*src[i][6]; - const int a6 = (src[i][6]<<2) + 10*src[i][2]; - const int a5 = ((src[i][0] - src[i][4]) << 3) + 4; - const int a4 = ((src[i][0] + src[i][4]) << 3) + 4; + const int a7 = (src[i][2]*4) - 10*src[i][6]; + const int a6 = (src[i][6]*4) + 10*src[i][2]; + const int a5 = ((src[i][0] - src[i][4]) * 8) + 4; + const int a4 = ((src[i][0] + src[i][4]) * 8) + 4; const int b0 = a4 + a6; const int b1 = a5 + a7; @@ -231,20 +231,20 @@ static void cavs_idct8_add_c(uint8_t *dst, int16_t *block, ptrdiff_t stride) src[i][7] = (b0 - b4) >> 3; } for( i = 0; i < 8; i++ ) { - const int a0 = 3*src[1][i] - (src[7][i]<<1); - const int a1 = 3*src[3][i] + (src[5][i]<<1); - const int a2 = (src[3][i]<<1) - 3*src[5][i]; - const int a3 = (src[1][i]<<1) + 3*src[7][i]; - - const int b4 = ((a0 + a1 + a3)<<1) + a1; - const int b5 = ((a0 - a1 + a2)<<1) + a0; - const int b6 = ((a3 - a2 - a1)<<1) + a3; - const int b7 = ((a0 - a2 - a3)<<1) - a2; - - const int a7 = (src[2][i]<<2) - 10*src[6][i]; - const int a6 = (src[6][i]<<2) + 10*src[2][i]; - const int a5 = (src[0][i] - src[4][i]) << 3; - const int a4 = (src[0][i] + src[4][i]) << 3; + const int a0 = 3*src[1][i] - (src[7][i]*2); + const int a1 = 3*src[3][i] + (src[5][i]*2); + const int a2 = (src[3][i]*2) - 3*src[5][i]; + const int a3 = (src[1][i]*2) + 3*src[7][i]; + + const int b4 = ((a0 + a1 + a3)*2) + a1; + const int b5 = ((a0 - a1 + a2)*2) + a0; + const int b6 = ((a3 - a2 - a1)*2) + a3; + const int b7 = ((a0 - a2 - a3)*2) - a2; + + const int a7 = (src[2][i]*4) - 10*src[6][i]; + const int a6 = (src[6][i]*4) + 10*src[2][i]; + const int a5 = (src[0][i] - src[4][i]) * 8; + const int a4 = (src[0][i] + src[4][i]) * 8; const int b0 = a4 + a6; const int b1 = a5 + a7; From patchwork Thu Feb 6 13:45:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 17702 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 11F6644A5B5 for ; Thu, 6 Feb 2020 15:54:22 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0117968AE90; Thu, 6 Feb 2020 15:54:21 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe05-3.mx.upcmail.net (vie01a-dmta-pe05-3.mx.upcmail.net [84.116.36.13]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D5BE068A297 for ; Thu, 6 Feb 2020 15:54:15 +0200 (EET) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe05.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1izhUY-0003Tm-0e for ffmpeg-devel@ffmpeg.org; Thu, 06 Feb 2020 14:46:50 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id zhTaikzH8wlyszhTaiqtF7; Thu, 06 Feb 2020 14:45:50 +0100 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=E5OzWpVl c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=nZOtpAppAAAA:20 a=iMHDJZBxuDV8VnUHyNMA:9 a=VlZU0XKO32wA:10 a=1fhp2MxaeJtTNGEnv6mo:22 a=Z5ABNNGmrOfJ6cZ5bIyy:22 a=SsAZrZ5W_gNWK9tOzrEV:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 6 Feb 2020 14:45:48 +0100 Message-Id: <20200206134549.29792-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200206134549.29792-1-michael@niedermayer.cc> References: <20200206134549.29792-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfFwA78vCgbOiv+iR/WA4X1DNwiECwNw0srYfdh4cZV8D3Zqk5869y/oqNbVEM1oareqYp5PA6vcKcI9G9UD9xUB4RFdWU20RR0puyFJZ3W9gSeg4mGhQ KYvrpSF9clzo1CQkPqvAGobWMlw76ICal6Zj6LLekL3oirAuRKbFOGNW Subject: [FFmpeg-devel] [PATCH 2/3] avformat/tty: Fix division by 0 in probe 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 zero Fixes: 20436/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5763229752229888 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/tty.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/tty.c b/libavformat/tty.c index 60f7e9f87e..854a23c500 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -53,6 +53,9 @@ static int read_probe(const AVProbeData *p) { int cnt = 0; + if (!p->buf_size) + return 0; + for (int i = 0; i < p->buf_size; i++) cnt += !!isansicode(p->buf[i]); From patchwork Thu Feb 6 13:45:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 17701 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 2772944A548 for ; Thu, 6 Feb 2020 15:53:53 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F0ECD68A661; Thu, 6 Feb 2020 15:53:52 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe06-2.mx.upcmail.net (vie01a-dmta-pe06-2.mx.upcmail.net [84.116.36.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 83CEB689C5D for ; Thu, 6 Feb 2020 15:53:46 +0200 (EET) 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 1izhUY-0000VK-0e for ffmpeg-devel@ffmpeg.org; Thu, 06 Feb 2020 14:46:50 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id zhTaikzHLwlyszhTaiqtFD; Thu, 06 Feb 2020 14:45:50 +0100 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=E5OzWpVl c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=nZOtpAppAAAA:20 a=JOYn1RK6zXVBY9463vIA:9 a=1fhp2MxaeJtTNGEnv6mo:22 a=GiHQeXbIydbNWtWbTz-1:22 a=p-dnK0njbqwfn1k4-x12:22 a=7aar8cbMflRChVwg8ngv:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 6 Feb 2020 14:45:49 +0100 Message-Id: <20200206134549.29792-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200206134549.29792-1-michael@niedermayer.cc> References: <20200206134549.29792-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfFwA78vCgbOiv+iR/WA4X1DNwiECwNw0srYfdh4cZV8D3Zqk5869y/oqNbVEM1oareqYp5PA6vcKcI9G9UD9xUB4RFdWU20RR0puyFJZ3W9gSeg4mGhQ KYvrpSF9clzo1CQkPqvAGobWMlw76ICal6Zj6LLekL3oirAuRKbFOGNW Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/intrax8: Check for end of bitstream in ff_intrax8_decode_picture() 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 (105sec -> 1sec) Fixes: 20479/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-5769846937878528 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/intrax8.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c index d46f97c7a4..f385423dc1 100644 --- a/libavcodec/intrax8.c +++ b/libavcodec/intrax8.c @@ -801,6 +801,8 @@ int ff_intrax8_decode_picture(IntraX8Context *w, Picture *pict, for (w->mb_y = 0; w->mb_y < w->mb_height * 2; w->mb_y++) { x8_init_block_index(w, w->frame); mb_xy = (w->mb_y >> 1) * (w->mb_width + 1); + if (get_bits_left(gb) < 1) + goto error; for (w->mb_x = 0; w->mb_x < w->mb_width * 2; w->mb_x++) { x8_get_prediction(w); if (x8_setup_spatial_predictor(w, 0))