From patchwork Sat Dec 2 23:39:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 6517 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp2815246jah; Sat, 2 Dec 2017 15:40:02 -0800 (PST) X-Google-Smtp-Source: AGs4zMZO4fRDuZEusiTrt9XMolLkpcAfbyYCRHSuSPt4F/5lQMBNErytxChwpnTTQafKbEPS8h4c X-Received: by 10.28.92.146 with SMTP id q140mr2179238wmb.41.1512258002654; Sat, 02 Dec 2017 15:40:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512258002; cv=none; d=google.com; s=arc-20160816; b=dGob6rmHZSQ5CXa0Wt1ud9dUWUDnw3m3KbUdq8XK1XtkbANcdQhW4d9c4uWF7ITZ7s 19rClxllTsZk0wZnrCQZSyh5iwncpK5F0Etrxi+211HNqDE4U3bgzVOu0AqPsLgD6xCT 9hBsPhNE7LH/N/z+/NydoQLidKXEDgkIvlTrfRhSb8FkgSjuTejM3RBNWZjMLIcKct48 az5Jct7AswslClhBt5liQkTmiX6PQuywiqWaH01MuI6y0BuPf3EE7A1ZzmLmyVPPZ/Dr Hm5Z9jEEaTuMkAdaqoWiFAkC3Hc3FzkWOu0DsIGkVTOLvRrfSq2KrRqdd3CJ7znl2nOO wmkA== 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=rZoskmVS5BKhJ1At2RjP8XnUwxB0a9uMwTEaDG1FwTo=; b=wcb1TAt6v4GVyn9yg1iWLdT1a5F6R96hs0O9tgsMH6Jn5rxHxiFGaK5HqjfTIsmp9+ YHhsTeT2ofkehaM7iAS8AzSa6JusknYcFNZLiFb0tbUM/pdd59uwt7dJ8CPvRQZMAhIn uhgstdV+94b/jgCq6J13HzzzBHcWzYJ5xF3jiT3p96DmEHlCVCdrhBWQfTB3H3vEEXz5 SS0yWZDvomNfQOE/D/oB/cbEuhrcOKl5S9u32X1IHhkGVwBZJUh3/uatVk3A1su20GIa cgD75dFnX1DdGEU26YDTl4GKoQVWqO3X0l9E4lOo+qgUH2qNxkeNA5lCx1+hmC8PxARd /imw== 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 o124si2459058wme.121.2017.12.02.15.40.01; Sat, 02 Dec 2017 15:40:02 -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 7A7F868A531; Sun, 3 Dec 2017 01:39:56 +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 89A3068A409 for ; Sun, 3 Dec 2017 01:39:50 +0200 (EET) Received: from [172.31.218.40] (helo=vie01a-dmta-pe04-1.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1eLHNy-0004xt-CK for ffmpeg-devel@ffmpeg.org; Sun, 03 Dec 2017 00:39:54 +0100 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe04.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1eLHNs-0004nH-Lm for ffmpeg-devel@ffmpeg.org; Sun, 03 Dec 2017 00:39:48 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id hBfj1w00l0S5wYM01BfkAS; Sun, 03 Dec 2017 00:39:44 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 3 Dec 2017 00:39:41 +0100 Message-Id: <20171202233941.18220-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171202233941.18220-1-michael@niedermayer.cc> References: <20171202233941.18220-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/diracdsp: Fix integer overflow in PUT_SIGNED_RECT_CLAMPED() 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: runtime error: signed integer overflow: 2147483646 + 2048 cannot be represented in type 'int' Fixes: 4479/clusterfuzz-testcase-minimized-6529894147162112 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/diracdsp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/diracdsp.c b/libavcodec/diracdsp.c index 8bc79b788c..2dd56f83f3 100644 --- a/libavcodec/diracdsp.c +++ b/libavcodec/diracdsp.c @@ -159,10 +159,10 @@ static void put_signed_rect_clamped_ ## PX ## bit_c(uint8_t *_dst, int dst_strid int32_t *src = (int32_t *)_src; \ for (y = 0; y < height; y++) { \ for (x = 0; x < width; x+=4) { \ - dst[x ] = av_clip_uintp2(src[x ] + (1 << (PX - 1)), PX); \ - dst[x+1] = av_clip_uintp2(src[x+1] + (1 << (PX - 1)), PX); \ - dst[x+2] = av_clip_uintp2(src[x+2] + (1 << (PX - 1)), PX); \ - dst[x+3] = av_clip_uintp2(src[x+3] + (1 << (PX - 1)), PX); \ + dst[x ] = av_clip_uintp2(src[x ] + (1U << (PX - 1)), PX); \ + dst[x+1] = av_clip_uintp2(src[x+1] + (1U << (PX - 1)), PX); \ + dst[x+2] = av_clip_uintp2(src[x+2] + (1U << (PX - 1)), PX); \ + dst[x+3] = av_clip_uintp2(src[x+3] + (1U << (PX - 1)), PX); \ } \ dst += dst_stride >> 1; \ src += src_stride >> 2; \