From patchwork Sun Aug 27 23:33:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 4861 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.15.201 with SMTP id 70csp1840475jao; Sun, 27 Aug 2017 16:34:05 -0700 (PDT) X-Received: by 10.223.130.113 with SMTP id 104mr3552390wrb.254.1503876845646; Sun, 27 Aug 2017 16:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503876845; cv=none; d=google.com; s=arc-20160816; b=MwCFjVesjhDfGvYnKCl2wdVzdlOYlR7kb2YRketGK+OMwPQCKMPvA9pvVISRFtpu2b VZvA+TIMZotRdRmThRBI6kn0YvxljrYWYJ7x0qgtGU5GnlFXJXLulHAdC6QAs8avFrJe d6zTXu4wUokjdXt+h1bTTJfLqB0pQM8ffVSGXlLEC5bC9kryu3Ht8HyER5nE1ChTjoSp Qwu+zA/8afy+VVih4m+L6EzUHM9saymaM1xzEo0dqjySpbdzDwE665NHJROicuofB2Fv /B4HRjpfDAhD47Dsu0JqKQ1Rm2/0Kljc1V7S48IAwis26hBsF8paneTQuQAFtHYmPJzA 3C2w== 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=UfMxS8V/eC67PnqV+vki5Nxc4f8Hlcd+Lhw4vRl7kxo=; b=IIbDVIuFNfwXKTKYqKmOScXhNzZ0Z+QrW/DufyeuTXugEdQgRbmM1sdIopCzByU+GU ELiNY4AXuS5dsOyK8Ep6epDnAbcrnxSdxACPtDy1B7ExR7jNAnm28Ujogyb8DcvvP4FV kOxzlp8zYWxV2A0n4VsaMQUKTFH2A1NHX5r4AZtMJt2zNnJZaHHkfHVjPYVtEAae7wSV fUMajXJ8oLNxL63v69On309roubIPavwIVeTqx7hlOfGNHrtn/Strlub0L5dMADVY+ef Tf7KbVwvLVjGI9leOzcXmtYQYrlUYJLMBKkVX8G2tLy5zKPqhh9AIFMc1o4xToZzcraS vosQ== 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 l12si3419682wre.458.2017.08.27.16.34.04; Sun, 27 Aug 2017 16:34:05 -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 89F60689CEB; Mon, 28 Aug 2017 02:33:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-3.mx.upcmail.net (vie01a-dmta-pe03-3.mx.upcmail.net [62.179.121.162]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A7E96687EB5 for ; Mon, 28 Aug 2017 02:33:45 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dm73y-0000M5-Rd for ffmpeg-devel@ffmpeg.org; Mon, 28 Aug 2017 01:33:54 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 2PZq1w0100S5wYM01PZrio; Mon, 28 Aug 2017 01:33:51 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 28 Aug 2017 01:33:49 +0200 Message-Id: <20170827233350.5037-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.14.1 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/hevc_ps: Fix undefined shift in pcm code 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: 3091/clusterfuzz-testcase-minimized-6229767969832960 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/hevc_ps.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 37eae226e2..ee31cc093c 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -1028,10 +1028,10 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, sps->pcm.log2_min_pcm_cb_size = get_ue_golomb_long(gb) + 3; sps->pcm.log2_max_pcm_cb_size = sps->pcm.log2_min_pcm_cb_size + get_ue_golomb_long(gb); - if (sps->pcm.bit_depth > sps->bit_depth) { + if (FFMAX(sps->pcm.bit_depth, sps->pcm.bit_depth_chroma) > sps->bit_depth) { av_log(avctx, AV_LOG_ERROR, - "PCM bit depth (%d) is greater than normal bit depth (%d)\n", - sps->pcm.bit_depth, sps->bit_depth); + "PCM bit depth (%d, %d) is greater than normal bit depth (%d)\n", + sps->pcm.bit_depth, sps->pcm.bit_depth_chroma, sps->bit_depth); return AVERROR_INVALIDDATA; }