From patchwork Sat Dec 2 23:39:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 6518 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp2815348jah; Sat, 2 Dec 2017 15:40:11 -0800 (PST) X-Google-Smtp-Source: AGs4zMbXYtpj5DO3lxydj+SEv4uk9I94czky0lt2RJ8QaWeL9TVD99H7NCTrSLbPRFbBDIIGw1Ix X-Received: by 10.28.0.193 with SMTP id 184mr4368389wma.58.1512258011053; Sat, 02 Dec 2017 15:40:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512258011; cv=none; d=google.com; s=arc-20160816; b=DgRB7hGoDzxr3S54Yxr8Auv9z3ABJGh4YmMSfebhKpq6Hdh9+hxfkSmzpXkdXRl/BI /EDqXcAJyhxyjRUBbJFj3AHObUXF8/qemaBjg0c/0ZsHP7eRE5v3981zcviQ2J0z3oZy KRdAQE7Zi9WmC3e61H1TXEY629f8MCgg7C3M9cSECrPgDfW8JSRlaSta4/52/ZTE2piZ 8X4qFd/+jlcF1ITP77vWNHd8YcAbjvgcgjWmc9BSkUlDeJ1sSi53IYH7fkqu/XNbDeo1 Zs4ev4kc3KZLbfzIwIRD2JKf8X/o3ggqR6SnlijNTXW4lrNxagUe9lHZUO/+khkLqM1l 8N2g== 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=6605HcA76lT4A8jWO2ype92uV7+BDIHZBFmQ7Zx1lLA=; b=BsG3fZBLG9aVCpgWe2a201/Qg9Wp5hEZU7Q+FNV2EItkflaeHIhQ4oXEV8SUKm5oWb +HLUd5gn2gs/ZBIDZiduMtI2Bw5t/wjDdcqne7MMLFYzL5Qe1BbBkE35sRSVf2StpIOD M5rN0EN54Z08+08LeWwCkRGabOrobg55FDrqUkM3CkM3tOdu+dfErVpc74C3BZu21o3B vZzNOnrY4gU92veuZzjEuRuxFvI4GG572hRGDdxWcIcco4l6Ko9ZlGHSJt2z1RYGzrR7 qMFLOV2gwAhIu2AET00+L2HeiN90C7+xlZ62ZJcK+Kn2N9MMSzu9gcIQebiDUhMgaa+v eKZw== 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 y91si7954911wrc.371.2017.12.02.15.40.10; Sat, 02 Dec 2017 15:40:11 -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 EB25D68A54C; Sun, 3 Dec 2017 01:40:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe02-3.mx.upcmail.net (vie01a-qmta-pe02-3.mx.upcmail.net [62.179.121.183]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 637BB68A545 for ; Sun, 3 Dec 2017 01:39:54 +0200 (EET) Received: from [172.31.218.50] (helo=vie01a-dmta-pe07-2.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1eLHO2-0004y6-G0 for ffmpeg-devel@ffmpeg.org; Sun, 03 Dec 2017 00:39:58 +0100 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 1eLHNw-00074c-IS for ffmpeg-devel@ffmpeg.org; Sun, 03 Dec 2017 00:39:52 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id hBfi1w00P0S5wYM01BfjA6; Sun, 03 Dec 2017 00:39:43 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 3 Dec 2017 00:39:40 +0100 Message-Id: <20171202233941.18220-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.15.0 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/dirac_dwt: Fix integer overflows in COMPOSE_DAUB97* 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: 4478/clusterfuzz-testcase-minimized-4752113767809024 Fixes: runtime error: signed integer overflow: -2147483626 + -319489 cannot be represented in type 'int' Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/dirac_dwt.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/dirac_dwt.h b/libavcodec/dirac_dwt.h index eb5aebc878..50c8b1e394 100644 --- a/libavcodec/dirac_dwt.h +++ b/libavcodec/dirac_dwt.h @@ -117,16 +117,16 @@ void ff_spatial_idwt_slice2(DWTContext *d, int y); ((unsigned)b4 + ((int)(-2*(b0+(unsigned)b8) + 10*(b1+(unsigned)b7) - 25*(b2+(unsigned)b6) + 81*(b3+(unsigned)b5) + 128) >> 8)) #define COMPOSE_DAUB97iL1(b0, b1, b2)\ - (b1 - ((int)(1817*(b0 + (unsigned)b2) + 2048) >> 12)) + ((unsigned)(b1) - ((int)(1817*(b0 + (unsigned)b2) + 2048) >> 12)) #define COMPOSE_DAUB97iH1(b0, b1, b2)\ - (b1 - ((int)( 113*(b0 + (unsigned)b2) + 64) >> 7)) + ((unsigned)(b1) - ((int)( 113*(b0 + (unsigned)b2) + 64) >> 7)) #define COMPOSE_DAUB97iL0(b0, b1, b2)\ - (b1 + ((int)( 217*(b0 + (unsigned)b2) + 2048) >> 12)) + ((unsigned)(b1) + ((int)( 217*(b0 + (unsigned)b2) + 2048) >> 12)) #define COMPOSE_DAUB97iH0(b0, b1, b2)\ - (b1 + ((int)(6497*(b0 + (unsigned)b2) + 2048) >> 12)) + ((unsigned)(b1) + ((int)(6497*(b0 + (unsigned)b2) + 2048) >> 12)) #endif /* AVCODEC_DWT_H */