From patchwork Sun Jan 7 03:12:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 7176 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.78.2 with SMTP id r2csp1149315jaa; Sat, 6 Jan 2018 19:13:19 -0800 (PST) X-Google-Smtp-Source: ACJfBotTDnkGkuLCWo092SJ+7yD8fvIFxcBj8kA3o0vEVxwb/1eMYIBfZMhCbyOI1MYIcOGrZeDi X-Received: by 10.28.105.193 with SMTP id z62mr5799562wmh.136.1515294799260; Sat, 06 Jan 2018 19:13:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515294799; cv=none; d=google.com; s=arc-20160816; b=yAkcXoKqrZ0zTZm4oYWrsQNZASAfh53aMRGyvSul+O2nDoLYl8KbNqS+SzntPSbEQ8 2VlEE3Q8yBHxVxLWdC+sKuF+u9v1JIt6DrjF3lId+Tdufq1CB4y3MModCqkz5eChN18K WR8cttD3jsVqpW8cuuANR4xL/ea6/aPNqxIXYbwsWDRTrY9W7FQf41dV7QsHqQQJ06AG o3he3ltTpnPXV2lmMqXRsIO+q7NlNlYcRnPL4brWHNU7QSKbSqQI/+ENkyMWPmt38hZ5 x8WmLSOUlF36KyuSp/UoUahZQEAGoHLkW/+nzRWbdWz/+EcIPWWG8V+3b3+LPPeSOcwp LbTw== 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:message-id:date:to:from:delivered-to :arc-authentication-results; bh=37rMniUUedWBaC+OPfi1YEMfCAn0hdWZdtaLfvwdMM4=; b=lTtRb1NNFLRMNR/MjFc6JYcXfcV1pGAOm4ZYRsz33qwemeFMYWFdsx4uFSpy0qXj1Z rFD7si3U7XQ9ZtE/z7SZnB8x7zGE0np+pFSUaONYJiQ6jCvvLT8Scue8QqtIXQuvsIGN l/yv3uIvr4+6P/JEUqjsX3fM7vMsl6Sb+w7vzM1j4V++wLzgjJdQU0bvPbr1dFwBymob tDwVxYW/21Ig//M4rBFqw2XnLuugxwzu7Q8bBe7zO3mCoKaj6/H+u73EGFDpOlBH4bP+ 2FJ26BY1ytRkzI/ArpDLd2CJ9VaWsAAQsRqS0X6kzN0+V6FsKvuWdPvG8Jp+TLWARfoi u2Eg== 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 u65si5750027wmb.245.2018.01.06.19.13.18; Sat, 06 Jan 2018 19:13:19 -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 24C1B689DAE; Sun, 7 Jan 2018 05:13:12 +0200 (EET) 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 38A72689D06 for ; Sun, 7 Jan 2018 05:13:05 +0200 (EET) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe06.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1eY1OT-000190-5X for ffmpeg-devel@ffmpeg.org; Sun, 07 Jan 2018 04:13:05 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id vFCz1w0030S5wYM01FD0ms; Sun, 07 Jan 2018 04:13:00 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 7 Jan 2018 04:12:57 +0100 Message-Id: <20180107031258.12135-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.15.1 Subject: [FFmpeg-devel] [PATCH 1/2] kavcodec/jpeg2000dsp: Fix integer overflows in ict_int() 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: 46802 * -71230 cannot be represented in type 'int' Fixes: 4756/clusterfuzz-testcase-minimized-4812495563784192 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/jpeg2000dsp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/jpeg2000dsp.c b/libavcodec/jpeg2000dsp.c index 85a12d0e9b..90e73b1e20 100644 --- a/libavcodec/jpeg2000dsp.c +++ b/libavcodec/jpeg2000dsp.c @@ -64,9 +64,9 @@ static void ict_int(void *_src0, void *_src1, void *_src2, int csize) int i; for (i = 0; i < csize; i++) { - i0 = *src0 + *src2 + (((26345 * *src2) + (1 << 15)) >> 16); + i0 = *src0 + *src2 + ((int)((26345U * *src2) + (1 << 15)) >> 16); i1 = *src0 - ((int)(((unsigned)i_ict_params[1] * *src1) + (1 << 15)) >> 16) - - (((i_ict_params[2] * *src2) + (1 << 15)) >> 16); + - ((int)(((unsigned)i_ict_params[2] * *src2) + (1 << 15)) >> 16); i2 = *src0 + (2 * *src1) + ((int)((-14942U * *src1) + (1 << 15)) >> 16); *src0++ = i0; *src1++ = i1;