From patchwork Thu Jun 14 15:15:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 9412 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:11c:0:0:0:0:0 with SMTP id c28-v6csp2042499jad; Thu, 14 Jun 2018 08:16:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKRsKU9BX1g4J/UWSepVRyYe1KBieGFMYking//7fQdVVZevDpPak8rhQ+Iux0ANCEd6mJi X-Received: by 2002:adf:e447:: with SMTP id t7-v6mr2795595wrm.145.1528989387353; Thu, 14 Jun 2018 08:16:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528989387; cv=none; d=google.com; s=arc-20160816; b=UAXce+fNGZiQv0mvY7Yz2XRtar2CArsPFJ3/yLtXd+1Hk4mHSKiwb+1zvE+U5BVr+A 4deBaZcFRdefmYwpulgKjuJ7BK8oUrC+FtBo6/dSc1jMwTBKCwgcme5VNENT3UuJl9Tz fGvd3qKOPBB5L4vbYs1ukfm+BdqaLgrJzZZlZsrFE4Aue/hzUn4z9y7mix7a82MUG5X8 uF5KQyb2AIzxSNC9wkxsmu5dMfdMNhLYA+20g51kBO4DBUVGBIS3ETNzku5h0xqTK/zT m1Fd9nLyJZVi02lAmh3PkADgfeSQH0dTME9ZAgsv9qeVdhx2TIzUq9ahjEX1ARSIrn+t CdiQ== 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=zpdRn8Jllx4dcPrOE+IWCqLyVA3exC6HKPrDM6wVQr8=; b=vBJ2ivB1h7vy05DIGWQi6DlJREphjpmVkQLvWnqzHyXQJcG6v6uRXjD7eiYUW66e5J kJDsQq7/vpyw+jz6hWyQ5PMfOMhU+0cpSaEFAZWYLHbdjTYdZh4JRmLa9r9IDVUMbhMe yaaCpW4/gykfgmrdImqrbjhqkNsvy/t2ocd1B9d1Ihi9keizr8bFdKPFl0IFGt5IuhKV U7/73qMVHB1o77FEAs9ABuZUWW3i/9NSTIopOSKSjN7Hj9pOs1PyGl0w/dC7frkpIIVn lsDG01tt5qW4KQ8AknwR2x50tIL47dmWg6iXFCxk/L/VRwDlpZcPp7YSLgeVuI5/HxMa nuUg== 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 o13-v6si4589934wri.328.2018.06.14.08.16.27; Thu, 14 Jun 2018 08:16:27 -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 50C6768AA6A; Thu, 14 Jun 2018 18:15:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe07-3.mx.upcmail.net (vie01a-dmta-pe07-3.mx.upcmail.net [84.116.36.19]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 25DB068AA5D for ; Thu, 14 Jun 2018 18:15:06 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe07.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fTTye-00041e-Kp for ffmpeg-devel@ffmpeg.org; Thu, 14 Jun 2018 17:15:56 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id yfFo1x01H0S5wYM01fFpUP; Thu, 14 Jun 2018 17:15:49 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 14 Jun 2018 17:15:17 +0200 Message-Id: <20180614151518.3950-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180614151518.3950-1-michael@niedermayer.cc> References: <20180614151518.3950-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 3/4] avcodec/dirac_dwt_template: Fix undefined behavior in interleave() 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: 2147483647 + 1 cannot be represented in type 'int' Fixes: 8697/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5197148130902016 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/dirac_dwt_template.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/dirac_dwt_template.c b/libavcodec/dirac_dwt_template.c index 8c25c1f822..528fc7e9e7 100644 --- a/libavcodec/dirac_dwt_template.c +++ b/libavcodec/dirac_dwt_template.c @@ -57,8 +57,8 @@ static av_always_inline void RENAME(interleave)(TYPE *dst, TYPE *src0, TYPE *src { int i; for (i = 0; i < w2; i++) { - dst[2*i ] = (src0[i] + add) >> shift; - dst[2*i+1] = (src1[i] + add) >> shift; + dst[2*i ] = (src0[i] + (unsigned)add) >> shift; + dst[2*i+1] = (src1[i] + (unsigned)add) >> shift; } }