From patchwork Sat Jul 29 14:27:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 4505 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.85 with SMTP id 82csp362399vsb; Sat, 29 Jul 2017 07:35:36 -0700 (PDT) X-Received: by 10.28.191.198 with SMTP id o67mr8117316wmi.149.1501338936605; Sat, 29 Jul 2017 07:35:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501338936; cv=none; d=google.com; s=arc-20160816; b=mq4NwHwL+m65H3UmJKg1ExEpZb3+9fWbAu7Q4tjVLP+RtvemGViBLlxFGSEFalERvI 18Oz1Poe5/l+8oFnnf0dQE8Cl1/BioNK1AsjRgSTDMSB5d1nQabMbtGoPzdgTWPpymQ6 ae/UaGEPLkJck8rd0mrfaZZFIlLpx11+0YEQWeJVzFBUW0dORlRalDitf1/FIY8wYYsk 6L1W9ggWaJSDYjfuWqkj/iMrzSiKfWMqS6M7cWENwX1sYQqT3806f2MR+gqYG+iBn4Jr fEmHt0qzUJiHFg9LvwKpnX3xpIyGYb0kLni21j2Czs+OnQXqVxsfKYCtmqV+DR4anzQG huoA== 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=GL2/gvJk2fQTPtbOsoPsrci5k6RMMwopStDtJ81tAhA=; b=JhCAQIHQog71VYxgXogGl1mog0ItmPgfiAiVVVaCTqmEFXs910nPImZjr/JeehyzM8 3Rb2DPe8tn4Fuah0CG5FA2PmC3gmKEJI+/T+kDn9epwkMA+XD+zjjwAzm1iU4+jmilLz V3a5OQDK32yGYwsZewLoG+140861+mIeC50uVCSoLH29Iy6/dnxmKckahA9Za3wI2/Fx 4skDzuDSv316a6vzdm4Y5Q2iDayuYrJsf+h6cZZCJacPQRJ1blyEJeUUwlcybvpFR+AN XcIuosnSWZr+0jjGHiyMR0eq/F8GiKn9QOD57wzJ+SwyzVRaEHF6QzB+b6CDKRwNYeml 4qZA== 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 2si19246015wrh.288.2017.07.29.07.35.36; Sat, 29 Jul 2017 07:35:36 -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 53C826899B2; Sat, 29 Jul 2017 17:35:32 +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-pe07-1.mx.upcmail.net [84.116.36.17]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0D5B46804AE for ; Sat, 29 Jul 2017 17:35:25 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe07.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dbSpz-0005c9-08 for ffmpeg-devel@ffmpeg.org; Sat, 29 Jul 2017 16:35:27 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id qeTt1v00L0S5wYM01eTuoJ; Sat, 29 Jul 2017 16:27:54 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 29 Jul 2017 16:27:51 +0200 Message-Id: <20170729142752.23098-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.13.0 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/diracdec: Check weight_log2denom 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 -1 is negative Fixes: 2742/clusterfuzz-testcase-minimized-5724322402402304 Fixes: 2744/clusterfuzz-testcase-minimized-4672435653705728 Fixes: 2749/clusterfuzz-testcase-minimized-5298741273690112 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/diracdec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index d2aaeab011..f2837aca69 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -1179,6 +1179,11 @@ static int dirac_unpack_prediction_parameters(DiracContext *s) if (get_bits1(gb)) { s->weight_log2denom = get_interleaved_ue_golomb(gb); + if (s->weight_log2denom < 1 || s->weight_log2denom > 8) { + av_log(s->avctx, AV_LOG_ERROR, "weight_log2denom unsupported or invalid\n"); + s->weight_log2denom = 1; + return AVERROR_INVALIDDATA; + } s->weight[0] = dirac_get_se_golomb(gb); if (s->num_refs == 2) s->weight[1] = dirac_get_se_golomb(gb);