From patchwork Thu Jun 18 12:20:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 20461 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 8AB0F44BAAD for ; Thu, 18 Jun 2020 15:26:49 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 67EAC68B75F; Thu, 18 Jun 2020 15:26:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe05-2.mx.upcmail.net (vie01a-dmta-pe05-2.mx.upcmail.net [84.116.36.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3554D68B4C0 for ; Thu, 18 Jun 2020 15:26:43 +0300 (EEST) 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 1jltXr-0004rU-08 for ffmpeg-devel@ffmpeg.org; Thu, 18 Jun 2020 14:21:27 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id ltWtjwUsf6Jy6ltWtjRuJk; Thu, 18 Jun 2020 14:20:27 +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=GKl27dFK 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=G-200KqZW7EKjR7nllgA:9 a=1fhp2MxaeJtTNGEnv6mo:22 a=Z5ABNNGmrOfJ6cZ5bIyy:22 a=jd6J4Gguk5HxikPWLKER:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 18 Jun 2020 14:20:23 +0200 Message-Id: <20200618122026.24534-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4wfJccxN8Zv/P1KU+udB41CwOt5IPMiDoI8EEDHC5g53zGRLK56+UvcunKM0mQ3zBBJdV0lRAC6Y4/YMoWlZzTVLkvv0jafVtl0Nz2Ha932JHHmJ8dtQuU /c4UA0+VkIqBikhio00TnJhaOMRfxYWL3Dmisy2rpHBV1OUjdLqOKDjN Subject: [FFmpeg-devel] [PATCH 1/4] avcodec/mv30: Fix integer overflows in idct2_1d() 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: signed integer overflow: 6500736 * 473 cannot be represented in type 'int' Fixes: 23259/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-5179394271477760 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/mv30.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/mv30.c b/libavcodec/mv30.c index 76b9170eaf..c83ba7ffbd 100644 --- a/libavcodec/mv30.c +++ b/libavcodec/mv30.c @@ -200,10 +200,10 @@ static inline void idct2_1d(int *blk, int step) { const int t0 = blk[0 * step]; const int t1 = blk[1 * step]; - const int t2 = t1 * 473 >> 8; + const int t2 = (int)(t1 * 473U) >> 8; const int t3 = t2 - t1; - const int t4 = (t1 * 362 >> 8) - t3; - const int t5 = ((t1 * 277 >> 8) - t2) + t4; + const int t4 = ((int)(t1 * 362U) >> 8) - t3; + const int t5 = (((int)(t1 * 277U) >> 8) - t2) + t4; blk[0 * step] = t1 + t0; blk[1 * step] = t0 + t3; From patchwork Thu Jun 18 12:20:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 20465 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:80ca:0:0:0:0:0 with SMTP id c10csp1327353ybm; Thu, 18 Jun 2020 05:27:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeQKMow4qkR0RrwdjnImwu4idZJ0luZKv5nnmqrKzGGuv/UwUyCqGanuSLwkeyGNUxj0sA X-Received: by 2002:a1c:44c3:: with SMTP id r186mr3731482wma.67.1592483226461; Thu, 18 Jun 2020 05:27:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592483226; cv=none; d=google.com; s=arc-20160816; b=U/pS6mYEQoMdBv1pzxcIp0ylFCOvWmdL5IogFdeZntlF6SrgzNSUGJLc11F0gPqCId f9nCduGRt2+Ib6cELpCCiJPyzCN5Kizh5YXa//f0l91EZ7Z2Lg+4tigcW9E8MbY1fxlm 262Dw9k9P+E5R8wiUCvFpS150VMZu49qcidPX82QsmQg6qGmxHroQCjZxzpMplhymQbs n3adYh1QONqtgyzkMvHkeZ95kcFXjmsrti9ftb0qooKTErnuO4bZV79qtM4T+Y+vG7c6 EFYkY7Q0vN24iiqhBubNLiZJrG+FXBvUBP9PLrR5KwNuDtSpp8woHeII8wGhBfWXdLY4 Rzvg== 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; bh=w77ttc4K+LmF0jWsOJsKWbwQ6QCD12URSfakX02QVt4=; b=0Fi3wMHzZLJ7y7k+YtWk6+qY7xEuXsx/zWYcTLGvGJPUAvTddI9Rmt0SoYfQJiyiO6 QCAIWP8HfftzcKf6hegN2k98kMVBR/UOc6rztOnSbWUoGaH98uUE74ukAUlKZ8MwLndr yHo9bKQAyzoW0gsOWxbXFVw7GAZHVzFoKxgDigyXmYCmTYBksGClleNqvvm1j84rlIZ9 fx75V/ElulQSFmacyTKcVfzxgMPs5uC9tFKud2u+4jlhFdHg7ht3G0KzSWJQgjGmwr1B TFZOQDKn0EkXMEYyoqyBbPGHlz9dHJCkDnOwj+9fU60c0v8c/+HbqZRNfRTEPUZ681S+ VZ9Q== 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 w4si2626011wrl.88.2020.06.18.05.27.05; Thu, 18 Jun 2020 05:27:06 -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 CBFE468B752; Thu, 18 Jun 2020 15:27:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe01-1.mx.upcmail.net (vie01a-dmta-pe01-1.mx.upcmail.net [62.179.121.154]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B2A4C68B752 for ; Thu, 18 Jun 2020 15:26:55 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe01.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1jltXs-000AKM-0H for ffmpeg-devel@ffmpeg.org; Thu, 18 Jun 2020 14:21:28 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id ltWujwUuU6Jy6ltWujRuKl; Thu, 18 Jun 2020 14:20:28 +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=GKl27dFK 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=31xsCM55cPVQV3pEuI8A:9 a=+jEqtf1s3R9VXZ0wqowq2kgwd+I=:19 a=1fhp2MxaeJtTNGEnv6mo:22 a=Z5ABNNGmrOfJ6cZ5bIyy:22 a=SsAZrZ5W_gNWK9tOzrEV:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 18 Jun 2020 14:20:24 +0200 Message-Id: <20200618122026.24534-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200618122026.24534-1-michael@niedermayer.cc> References: <20200618122026.24534-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfGGMK20tfpl030lNKln8gTSuPqbYz9GrgGDQUP/dp7rIW7MxxzdTm2Vrie3c/ELSO0rc/8+cNvCczgKa0HGMGR9uA+Twc2faDhV2OxlqsCS/QjT5f0xZ IeK1MbDViQ+Rslw+4e1vy/1pHNYciHT3Pr1bESzmBbUO4KG/SwrOC0Lx Subject: [FFmpeg-devel] [PATCH 2/4] avutil/avsscanf: Add () to avoid integer overflow in scanexp() 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" X-TUID: Ypq7AZ8on5F3 Content-Length: 1678 Fixes: signed integer overflow: 2147483610 + 52 cannot be represented in type 'int' Fixes: 23260/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PBM_fuzzer-5187871274434560 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavutil/avsscanf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/avsscanf.c b/libavutil/avsscanf.c index 1c85412fd4..850c117940 100644 --- a/libavutil/avsscanf.c +++ b/libavutil/avsscanf.c @@ -229,9 +229,9 @@ static long long scanexp(FFFILE *f, int pok) return LLONG_MIN; } for (x=0; c-'0'<10U && x X-Patchwork-Id: 20459 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 3171D44B8B3 for ; Thu, 18 Jun 2020 15:21:35 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0F7DC68B1AF; Thu, 18 Jun 2020 15:21:35 +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 9369A68AAAD for ; Thu, 18 Jun 2020 15:21:28 +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 1jltXs-0009nP-0H for ffmpeg-devel@ffmpeg.org; Thu, 18 Jun 2020 14:21:28 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id ltWujwUuy6Jy6ltWujRuKu; Thu, 18 Jun 2020 14:20:28 +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=GKl27dFK 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=gBtlCSJy6BATaCpSGqMA: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, 18 Jun 2020 14:20:25 +0200 Message-Id: <20200618122026.24534-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200618122026.24534-1-michael@niedermayer.cc> References: <20200618122026.24534-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfGGMK20tfpl030lNKln8gTSuPqbYz9GrgGDQUP/dp7rIW7MxxzdTm2Vrie3c/ELSO0rc/8+cNvCczgKa0HGMGR9uA+Twc2faDhV2OxlqsCS/QjT5f0xZ IeK1MbDViQ+Rslw+4e1vy/1pHNYciHT3Pr1bESzmBbUO4KG/SwrOC0Lx Subject: [FFmpeg-devel] [PATCH 3/4] avcodec/cbs_av1: Fixes: check if the value of cbs_av1_write_uvlc() is supported 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: assertion failure Fixes: left shift of 1 by 31 places cannot be represented in type 'int' Fixes: 23264/clusterfuzz-testcase-minimized-ffmpeg_BSF_AV1_METADATA_fuzzer-6308429248593920 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/cbs_av1.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c index 29b316e011..4092c9dd06 100644 --- a/libavcodec/cbs_av1.c +++ b/libavcodec/cbs_av1.c @@ -125,6 +125,8 @@ static int cbs_av1_write_uvlc(CodedBitstreamContext *ctx, PutBitContext *pbc, put_bits(pbc, 1, 1); } else { zeroes = av_log2(value + 1); + if (zeroes > 30) + return AVERROR(EINVAL); v = value - (1 << zeroes) + 1; put_bits(pbc, zeroes + 1, 1); put_bits(pbc, zeroes, v); From patchwork Thu Jun 18 12:20:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 20460 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 1EB5544B8B3 for ; Thu, 18 Jun 2020 15:21:36 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0599368B76E; Thu, 18 Jun 2020 15:21:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe02-3.mx.upcmail.net (vie01a-dmta-pe02-3.mx.upcmail.net [62.179.121.159]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9621168B739 for ; Thu, 18 Jun 2020 15:21:28 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe02.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1jltXs-0004Ik-0I for ffmpeg-devel@ffmpeg.org; Thu, 18 Jun 2020 14:21:28 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id ltWujwUv56Jy6ltWujRuL5; Thu, 18 Jun 2020 14:20:28 +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=GKl27dFK 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=w_77gcsbBIBZIg1FZkYA:9 a=1fhp2MxaeJtTNGEnv6mo:22 a=Z5ABNNGmrOfJ6cZ5bIyy:22 a=UDnyf2zBuKT2w-IlGP_r:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 18 Jun 2020 14:20:26 +0200 Message-Id: <20200618122026.24534-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200618122026.24534-1-michael@niedermayer.cc> References: <20200618122026.24534-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfGGMK20tfpl030lNKln8gTSuPqbYz9GrgGDQUP/dp7rIW7MxxzdTm2Vrie3c/ELSO0rc/8+cNvCczgKa0HGMGR9uA+Twc2faDhV2OxlqsCS/QjT5f0xZ IeK1MbDViQ+Rslw+4e1vy/1pHNYciHT3Pr1bESzmBbUO4KG/SwrOC0Lx Subject: [FFmpeg-devel] [PATCH 4/4] avcodec/tdsc: Only reallocate deflatebuffer if its size changed 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 (47sec -> 35msec) Fixes: 23375/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TDSC_fuzzer-5633949497032704 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/tdsc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libavcodec/tdsc.c b/libavcodec/tdsc.c index eaea41c1f5..cd03558ecd 100644 --- a/libavcodec/tdsc.c +++ b/libavcodec/tdsc.c @@ -530,10 +530,15 @@ static int tdsc_decode_frame(AVCodecContext *avctx, void *data, /* Resize deflate buffer on resolution change */ if (ctx->width != avctx->width || ctx->height != avctx->height) { - ctx->deflatelen = avctx->width * avctx->height * (3 + 1); - ret = av_reallocp(&ctx->deflatebuffer, ctx->deflatelen); - if (ret < 0) - return ret; + int deflatelen = avctx->width * avctx->height * (3 + 1); + if (deflatelen != ctx->deflatelen) { + ctx->deflatelen =deflatelen; + ret = av_reallocp(&ctx->deflatebuffer, ctx->deflatelen); + if (ret < 0) { + ctx->deflatelen = 0; + return ret; + } + } } dlen = ctx->deflatelen;