From patchwork Fri Jun 9 01:14: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: 3881 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.10.2 with SMTP id 2csp3115821vsk; Thu, 8 Jun 2017 18:14:27 -0700 (PDT) X-Received: by 10.28.229.144 with SMTP id c138mr5145595wmh.60.1496970867004; Thu, 08 Jun 2017 18:14:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496970866; cv=none; d=google.com; s=arc-20160816; b=cAFamTVG22PcTc3Sz2dIvsC8GwY56oJiK+ja/zbe4YtBtQlyZnjQKW96aAiEBR/88n bAADmjcD/Xau0v4hvTxHAKI59xUvZh4/qkmhVWDPWJvKjwgblJe/lQNG9iVBVKwKx01q wKpwJUxvNBVoYQh0PMor2IdzGGwVIfJar8nC1StNG8MNyl/ILC6QdBI3Yn9VeMIe7XAg 8NVKRzuCAPhHQAWHyGs8Tanm346Ym6ZrCtfTcWNXEjBVLy1u/o5y4jDapDzzueGqNASP sDYgHIp+EvwIcCJQ7DIFubKAAHIK0HDNCJ0OJkBHkl0VOFkjLzFxazTQJp/uuPk47kwu AuiQ== 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=RA7soX1UjbRFOJbkj4WNt14RlpP09hsLtJOtnyyoCfk=; b=l90eVN3gp/lCdtKuFvJrCwKdxomMPkHJX0xPtG1faJNlUsyCKliAykTnV1RTzjN7F3 eGwUBdljCzbi1JenPtsMamx5dZJXzCvpid+1d3RY0mAZ0GlYC7eDQIAxPv8JzvCWkBzj WSwsQDcfnhg1mhRyi+J4NOH6nKwjzsXoZpqwSpMUDyBBBYarSY3V9PtUYye12V+8pNAM 5Ii4Pt6TJFi9BCimuWj7WKlshd6iLg+axYr65/JutvrzkFO6aENt9bOrQFQ4+q9HXA4G IbKi7s4WHmg2Ip9H7LerRTkP3BAvQAvAOziWBkJpLQy1/T7fHAuazKEgPt5gjuM/j/d5 UHSQ== 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 e138si348231wme.151.2017.06.08.18.14.26; Thu, 08 Jun 2017 18:14:26 -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 615AA689D75; Fri, 9 Jun 2017 04:14:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe02-3.mx.upcmail.net (vie01a-dmta-pe02-3.mx.upcmail.net [62.179.121.159]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F1949680A6C for ; Fri, 9 Jun 2017 04:14:17 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dJ8VF-0000Ko-OQ for ffmpeg-devel@ffmpeg.org; Fri, 09 Jun 2017 03:14:17 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id WRED1v00c0S5wYM01REEuJ; Fri, 09 Jun 2017 03:14:14 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 9 Jun 2017 03:14:12 +0200 Message-Id: <20170609011412.14323-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.13.0 Subject: [FFmpeg-devel] [PATCH] avcodec/shorten: Sanity check maxnlpc 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 OOM Fixes: 2131/clusterfuzz-testcase-minimized-4718045157130240 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/shorten.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index b785284aa2..18b77300a0 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -445,6 +445,10 @@ static int read_header(ShortenContext *s) s->blocksize = blocksize; maxnlpc = get_uint(s, LPCQSIZE); + if (maxnlpc > 1024U) { + av_log(s->avctx, AV_LOG_ERROR, "maxnlpc is: %d\n", maxnlpc); + return AVERROR_INVALIDDATA; + } s->nmean = get_uint(s, 0); skip_bytes = get_uint(s, NSKIPSIZE);