From patchwork Mon Sep 18 23:04:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 5188 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.36.26 with SMTP id f26csp4001650jaa; Mon, 18 Sep 2017 16:05:16 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5jBnbjvsAFSh7Ly37Y+2mEPoN0qExaucYWEJeMFh2Wh8uajExnd6soVr3YzI3xevTmMlPF X-Received: by 10.223.171.93 with SMTP id r29mr29170363wrc.217.1505775916608; Mon, 18 Sep 2017 16:05:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505775916; cv=none; d=google.com; s=arc-20160816; b=CbCSC3buMEALlo5RonNED4l49+kIyfWbJoXFeZW4GPI+FCUM5yTf+68qG0XupI6sS0 KP7VBUzJAzx4rMr2cAM6ivmOKCX2HKPvbkjcBVPa7OmvgliUTp8/2Vd3uIk7RmFMYKK2 nBHM4EbBqHcsCnSBC+jxY4l0xqpYlyjNOXVEIUYiHxTTbbtVS7I/qk4SBAybUbIyNeVt w8gQYage+p3ANhAquLfRWBkQbSRqHX2yztd3Ws/GcYUo1NMiIc/S9gpe1LwM1Myt+f9U ib9vS2rs4ahtpz1NiNeIEBOyDM/R1DaHY39or+dKHsarsM10+0pzZUwB4isPi5XGBiqS XXeg== 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=fpStUF0D9+NF7wDjg5MP3PpRd3RNWH5Xf6C3OcnLxjg=; b=btk0ofDYohGMg+EPP+05uim/0213/M7CusFZqxrKD8JXlgUcAMMTI0jCxF7PwSbRKb eWN7BeA65FPFQf6+LYTGXIvKmzVO0PuI5vD8f9dqDhJ6imXycS3Zp+VUSMMveUWsWpPV 2czPdS1tL/kqSOk793FOf+pIR3WjipA4U0je1OMz9+mkCWFm2bfHLOEK2AY8wkFrCQAz nEMCecEZWZtZpPbkcLtdpbKr8p9pZQjRlEHE74BKlzQ9ZHfV3DwpGVfAUoqSMQ/1yJ4+ qnHwZw3GGSlIIjLaVdT7aZ2H9iw95+gfVQMLtJM9vZChSMwARN7QMRzwMcOxSFBtX4hv /zZA== 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 x21si195896wme.219.2017.09.18.16.05.15; Mon, 18 Sep 2017 16:05:16 -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 A84B368063B; Tue, 19 Sep 2017 02:05:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe02-1.mx.upcmail.net (vie01a-qmta-pe02-1.mx.upcmail.net [62.179.121.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4956868063B for ; Tue, 19 Sep 2017 02:04:59 +0300 (EEST) Received: from [172.31.218.42] (helo=vie01a-dmta-pe04-3.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1du56B-0007re-RX for ffmpeg-devel@ffmpeg.org; Tue, 19 Sep 2017 01:05:07 +0200 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 1du565-0007eA-Um for ffmpeg-devel@ffmpeg.org; Tue, 19 Sep 2017 01:05:01 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id BB4t1w01C0S5wYM01B4uHd; Tue, 19 Sep 2017 01:04:54 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 19 Sep 2017 01:04:52 +0200 Message-Id: <20170918230453.19774-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.14.1 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/svq3: Fix overflow in svq3_add_idct_c() 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: 2147392585 + 524288 cannot be represented in type 'int' Fixes: 3348/clusterfuzz-testcase-minimized-4809500517203968 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/svq3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c index a766fa49ad..5cb5bd45b7 100644 --- a/libavcodec/svq3.c +++ b/libavcodec/svq3.c @@ -285,7 +285,7 @@ static void svq3_add_idct_c(uint8_t *dst, int16_t *block, const unsigned z1 = 13 * (block[i + 4 * 0] - block[i + 4 * 2]); const unsigned z2 = 7 * block[i + 4 * 1] - 17 * block[i + 4 * 3]; const unsigned z3 = 17 * block[i + 4 * 1] + 7 * block[i + 4 * 3]; - const int rr = (dc + 0x80000); + const int rr = (dc + 0x80000u); dst[i + stride * 0] = av_clip_uint8(dst[i + stride * 0] + ((int)((z0 + z3) * qmul + rr) >> 20)); dst[i + stride * 1] = av_clip_uint8(dst[i + stride * 1] + ((int)((z1 + z2) * qmul + rr) >> 20));