From patchwork Fri Jul 28 01:22:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 4479 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp2680295vsb; Thu, 27 Jul 2017 18:23:03 -0700 (PDT) X-Received: by 10.28.94.13 with SMTP id s13mr4591669wmb.33.1501204983461; Thu, 27 Jul 2017 18:23:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501204983; cv=none; d=google.com; s=arc-20160816; b=sXMyz2AaL+J5UtrQfkueIO7V0yTnf0J2TRCPynpFKyoBWazpHCjtUnaDbovfw7pD9O NiyuYRhSINUBF/ruR6+66bw9B/GWyKPwuSg7flq/mLSJrkkeAVq2T6BWVP0/go5BCSZ/ 5RUoHqDA70daluW7uoH9c3eo2ZKzarrKf0UTR+ozo8TZYM05SR3yI7qM6CHVLPO36qU3 nLRbvVAy9R9v4URVl/j7LaYXGzDsxtI2K9o11TZfNeT+bJCa6Hjk0GXy0YkyQuSLhYJs baT8B0F4XRQ9+bXCegY5IYmGs9AK5nTGasHTKtiiFhD8V4JuxB3bTuXaYS1d9ksvPhin YTEA== 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=qXgCg21/YPFtJIzkUq1A8UFTJ4i54JR2ySqaYZgWTVE=; b=JDwD3xbqTIZCy0kbXb5q9rpyj5W9DMGs+0Zd3voseOpSsYQa5ayHX6QDwCfy3oYWbr vy+xJ3cHaQlLFwKnDsFCuw6vFSdS31fd8ddjyL+TY1l5VFLBUW9T2fO3YjfwJZ9NMoZO 5rESr4dqp3TBRASF94NQ5kL0s28DuBAgm3hELvJ+t16hcMA8ORY2mLDWofY1dF3JAxWh A9RjR7+ukSReViP3aYYCXifaZ8Pm67twKLbRbrbksO6zl5Oroe03xha2/B8SfUtzMex0 6H0u9jEn08kp2GNqeemjNtdu8W51eh7JNY9iMeNxWSLM8womV5aVuWHXMtL+xK+Xg4Mk xgHg== 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 7si16977452wrd.171.2017.07.27.18.23.03; Thu, 27 Jul 2017 18:23:03 -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 6E37F6891FB; Fri, 28 Jul 2017 04:22:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe05-1.mx.upcmail.net (vie01a-dmta-pe08-1.mx.upcmail.net [84.116.36.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1AA88680957 for ; Fri, 28 Jul 2017 04:22:48 +0300 (EEST) 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 1datzM-0007V5-LF for ffmpeg-devel@ffmpeg.org; Fri, 28 Jul 2017 03:22:48 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id q1Nh1v00X0S5wYM011NiKy; Fri, 28 Jul 2017 03:22:42 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 28 Jul 2017 03:22:39 +0200 Message-Id: <20170728012240.5464-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.13.0 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/dirac_vlc: Fix invalid shift 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: shift exponent 65 is too large for 64-bit type 'residual' (aka 'unsigned long') Fixes: 2737/clusterfuzz-testcase-minimized-4968639147016192 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/dirac_vlc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/dirac_vlc.c b/libavcodec/dirac_vlc.c index 773f720858..f9a6017ec0 100644 --- a/libavcodec/dirac_vlc.c +++ b/libavcodec/dirac_vlc.c @@ -96,6 +96,9 @@ int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, if ((c_idx + 1) > coeffs) return c_idx; + if (res_bits >= RSIZE_BITS) + return 0; + if (res_bits && l->sign) { int32_t coeff = 1; APPEND_RESIDUE(res, l->preamble);