From patchwork Wed Jan 24 03:34:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 7407 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.156.27 with SMTP id q27csp252419jak; Tue, 23 Jan 2018 19:35:11 -0800 (PST) X-Google-Smtp-Source: AH8x227v1EgsZ/weBgF0BEs9a4GdsygtgMpuP7nXeoCKAuAQJa/NGJ+b7BNbswz2ZtOjq1VgXIOl X-Received: by 10.28.218.207 with SMTP id r198mr3447972wmg.138.1516764911579; Tue, 23 Jan 2018 19:35:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516764911; cv=none; d=google.com; s=arc-20160816; b=sy+o5xU079QGO7CIXxXfgmJWCHRi3xUjYdAnaeo+8xwn2upQCvSFNtzsYTOO1QgBAf OC5gOxrXGYAdHIOHmAaSZzafAbz1SAcERQmcxQ+OcJQlXbDE5+caJBtVBtZ6QeTbong6 lHZo1aMSChU2ycbIVALI4PPXMH3WtjJQ0/JdGqm14O5CIFDuphFZG/VbYCOO6kVfw6op U6uf0yQ19K3Gl1jspaK9RD+066y2ZEKbins1NokzWOBVgOSlKnDfSrp5zGGOsez2S8UP 5SrhZKAvMI43aPWUo7lgPRmzxOZ5aBwc5Lei2czV4qgPkskWppeN5cVWeVo6e1ZYatkL qZYw== 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=2dfmMcG1nXFdkBxwD7sqpyluLRBBTKZOdrAD5+4CcGc=; b=AadIU8UfZGDRE9pDOHzqyH2GwA2tVrrTp5suU2TvmjqVOgLwdwjuoEtHL4US+yXdGL m+z8BBqe2sKSxMEByw+azI3X3mlBhxrY0bcm3QV7VpfisCIv2hhyuTUQRgqyBot2YH7X XBQkCwSfIMwabXu5bsALwncvXiYBRIr3zxcrnSCHuSGkoD9tdXjKByo+yZMvyPb65SHn nLQpR4NCl6kSoBnyqA5iFrbVmk+YUh1ZZ+4mw6KOYmJFoDD2uu9/KmeMK9khbiVN4qze QYxZbgYy9waFVn7E1Wvn71O42SuAuE8ZxhOKooZFIwK2BANKYP5WSp7toIWaZ7C31amg gsSA== 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 d22si1328587wra.341.2018.01.23.19.35.10; Tue, 23 Jan 2018 19:35: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 3A556689DE1; Wed, 24 Jan 2018 05:35:07 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe08-1.mx.upcmail.net (vie01a-dmta-pe08-1.mx.upcmail.net [84.116.36.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 42F50689B35 for ; Wed, 24 Jan 2018 05:35:01 +0200 (EET) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe08.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1eeBq3-0000EY-2M for ffmpeg-devel@ffmpeg.org; Wed, 24 Jan 2018 04:35:03 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 23as1x01t0S5wYM013atgo; Wed, 24 Jan 2018 04:34:54 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 24 Jan 2018 04:34:50 +0100 Message-Id: <20180124033450.4520-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180124033450.4520-1-michael@niedermayer.cc> References: <20180124033450.4520-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/mjpegdec: Fix integer overflow in DC dequantization 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: -65535 * 65312 cannot be represented in type 'int' Fixes: 4900/clusterfuzz-testcase-minimized-5769019744321536 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/mjpegdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index e005dd0cd3..5055ee2826 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -715,7 +715,7 @@ static int decode_block(MJpegDecodeContext *s, int16_t *block, int component, av_log(s->avctx, AV_LOG_ERROR, "error dc\n"); return AVERROR_INVALIDDATA; } - val = val * quant_matrix[0] + s->last_dc[component]; + val = val * (unsigned)quant_matrix[0] + s->last_dc[component]; val = av_clip_int16(val); s->last_dc[component] = val; block[0] = val;