From patchwork Fri Sep 1 17:56:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 4942 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.15.201 with SMTP id 70csp862190jao; Fri, 1 Sep 2017 10:56:39 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5GwHglRLOfNybF5SpfofihXtBFSrIqc3rDEMk3e1o+owzyOkozUUnKY5+J4nlUgeRKUDJP X-Received: by 10.223.161.198 with SMTP id v6mr1588373wrv.171.1504288599314; Fri, 01 Sep 2017 10:56:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504288599; cv=none; d=google.com; s=arc-20160816; b=pPncoGpHJh/IEXA9MnaIEEB5cntz97JwSVrvUWZcOIiHp3sU0QZindiFS3i49fTJ35 B3XF00/cUcTz12bBfccwIaMAJ8UV1ce9L9VTarN4hwrcD0TxIw6hOiSREOkLWI0ERTyG tGT6mJFbljC5pHeQAWoZaIrfseGzdS41QvgRnVnkEt7AnE/iGM1L2qJjV3HsCH8S1q+O wexYAWQzsYspPxbZaG2U8i1F6QEzqwS2LVmBjSAgyTfFrISOp420YEbsIzhnysBwPdIA A6onMGVzY6QER7DqOZqhSuFNDiBtsuUEg4/5AdNQWM8ocz0jMtqPCRMg2q401Ebbx460 iYXQ== 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=ZELGCyy1/06yVgROG+/yEzRk51JNjxbcZ2NAFKuHSjg=; b=LE33zpCAHYrAU3LMqEfhIWgyrqzmBR3QwTTdAOE+p+U87WKyia9bx9MwJ+y14s3Dqp w+KTaVStXtaL/vo9vNlkwcP6SPP2/0ZbhmcUsAifvUq+W2zPln2GmB2oYVQite9Y8igX HTFlMnQCh+Rjti9/MNkYooCvESJZQFzRyKjYFVJrDCki74KX52ouUs2cveK/FcEUdVsd IAK1kd3BlGRzbu9C4VhfZV0iQftFy41bvum4Z9oLZgYbiqHLAzSKX2oFDWroV00Uf5cx u3bLzBK818uN0efra51DFZknNxPNT4aQal3OMH4HisRFK0h+0rk5Kokn2o4+dyWwrrRD Ogow== 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 g130si500159wme.134.2017.09.01.10.56.39; Fri, 01 Sep 2017 10:56:39 -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 EE88668A276; Fri, 1 Sep 2017 20:56:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-1.mx.upcmail.net (vie01a-qmta-pe01-1.mx.upcmail.net [62.179.121.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8527868A264 for ; Fri, 1 Sep 2017 20:56:24 +0300 (EEST) Received: from [172.31.218.31] (helo=vie01a-dmta-pe01-1.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dnqB7-0002E8-L6 for ffmpeg-devel@ffmpeg.org; Fri, 01 Sep 2017 19:56:25 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dnqB1-0004kS-Ej for ffmpeg-devel@ffmpeg.org; Fri, 01 Sep 2017 19:56:19 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 4HwF1w00n0S5wYM01HwGhn; Fri, 01 Sep 2017 19:56:16 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 1 Sep 2017 19:56:12 +0200 Message-Id: <20170901175612.18603-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170901175612.18603-1-michael@niedermayer.cc> References: <20170901175612.18603-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/dirac_vlc: Fix invalid shift in ff_dirac_golomb_read_32bit() 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 64 is too large for 64-bit type 'residual' (aka 'unsigned long') Fixes: 2838/clusterfuzz-testcase-minimized-6260066086813696 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 d3b9900beb..bd37f31f46 100644 --- a/libavcodec/dirac_vlc.c +++ b/libavcodec/dirac_vlc.c @@ -56,6 +56,9 @@ int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, if ((c_idx + 1) > coeffs) return c_idx; + if (res_bits >= RSIZE_BITS) + res_bits = res = 0; + /* res_bits is a hint for better branch prediction */ if (res_bits && l->sign) { int32_t coeff = 1;