From patchwork Sat Feb 17 23:34:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 7636 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.150.1 with SMTP id c1csp2273306jai; Sat, 17 Feb 2018 15:34:36 -0800 (PST) X-Google-Smtp-Source: AH8x227bU/6IiPL7nHLtM7UzUUFdJrkWraEVJdaYOynS7+0Ohca1RboVwhX5ej/+t6BZmoHfSe0N X-Received: by 10.28.8.66 with SMTP id 63mr7333499wmi.161.1518910476103; Sat, 17 Feb 2018 15:34:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518910476; cv=none; d=google.com; s=arc-20160816; b=JTyAe5h9oYqvy93tn1oCqzhbAz0zBWcSnhUWRXCHtHe4vqRa3BjonOpySY67aufBWG bg0huOjT+o11QTuSP0P74C4e5Ag0iAISJ6j7hglpat/I6WmYeFSjnP7Ab3FLZjWVTn0Q Fg66JCAeZSiDVCgLtWiq3c0hPAVE/4ACbvlEHgB//5vP8i3XmoIg7l4k0N+QWa1H+tNv U9Av1F7QFwh0JUG1lW3N67fZ0Xtg4DTG5yLsSWJYSlcOjTB2icYhCMQ6D6L5RraICaCC zfkugRT1pr4z0cIVVoUstkD1rP0Adeod1gLZ9S5INzLxO73fud7zp7Y6TQ6ljnYM9zOv 3iNA== 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=btAMZHbdTLLflETgeUgmvr3LV+jzugp1K1Je9CU054k=; b=YnOleDeZFm+IzFFDVQa67thwu5Y2YO1esKxGqysT+I0mGY6Mszq/8XCGAyNzG9L3WS ZesLsxaoigMrSExc1s5+KuzSG1U1+DauPanIPQXo+2WgGpfdtlYVGhEeIlDIZTi2PxXS FkhNYAeHLGVWh/cnfyLUQcXmQR27t3Y6lSml7mw9db9veGpNDv6Pqg0/9I26AeqUrU4p s5owagdgWYAR5zizyg0UMQr23afY0uMDNYHrf4xiP3CNmUSXDDsyWpBpr+UOivALaBcu sem9i0fmq8BVxPbcqYFTb2+Assbxuj3EnfmUXx9M3js+LgfEjONY14p9mvD/l7ur0oWN nHsQ== 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 j13si6469921wrb.239.2018.02.17.15.34.35; Sat, 17 Feb 2018 15:34:36 -0800 (PST) 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 6E196689AAF; Sun, 18 Feb 2018 01:34:25 +0200 (EET) 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 EDC746899B7 for ; Sun, 18 Feb 2018 01:34:18 +0200 (EET) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1enBzm-0004lx-Lf for ffmpeg-devel@ffmpeg.org; Sun, 18 Feb 2018 00:34:18 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id BzaD1x01E0S5wYM01zaEeP; Sun, 18 Feb 2018 00:34:14 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 18 Feb 2018 00:34:11 +0100 Message-Id: <20180217233411.3703-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180217233411.3703-1-michael@niedermayer.cc> References: <20180217233411.3703-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/jpeg2000dwt: Fix integer overflows in sr_1d53() 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: 5918/clusterfuzz-testcase-minimized-5120505435652096 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/jpeg2000dwt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/jpeg2000dwt.c b/libavcodec/jpeg2000dwt.c index 55dd5e89b5..ce1678a3d7 100644 --- a/libavcodec/jpeg2000dwt.c +++ b/libavcodec/jpeg2000dwt.c @@ -305,22 +305,22 @@ static void dwt_encode97_int(DWTContext *s, int *t) t[i] = (t[i] + ((1<>1)) >> I_PRESHIFT; } -static void sr_1d53(int *p, int i0, int i1) +static void sr_1d53(unsigned *p, int i0, int i1) { int i; if (i1 <= i0 + 1) { if (i0 == 1) - p[1] >>= 1; + p[1] = (int)p[1] >> 1; return; } extend53(p, i0, i1); for (i = (i0 >> 1); i < (i1 >> 1) + 1; i++) - p[2 * i] -= (p[2 * i - 1] + p[2 * i + 1] + 2) >> 2; + p[2 * i] -= (int)(p[2 * i - 1] + p[2 * i + 1] + 2) >> 2; for (i = (i0 >> 1); i < (i1 >> 1); i++) - p[2 * i + 1] += (p[2 * i] + p[2 * i + 2]) >> 1; + p[2 * i + 1] += (int)(p[2 * i] + p[2 * i + 2]) >> 1; } static void dwt_decode53(DWTContext *s, int *t)