From patchwork Fri Feb 9 03:41:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 7531 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.150.1 with SMTP id c1csp284491jai; Thu, 8 Feb 2018 19:42:06 -0800 (PST) X-Google-Smtp-Source: AH8x227TIXByE/6PfwTEZeZbaT5WUK4SUtwQCH0IazbTqa88lWFtit++On/I0ie/Z0217GgSEesC X-Received: by 10.223.171.3 with SMTP id q3mr1017695wrc.64.1518147726465; Thu, 08 Feb 2018 19:42:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518147726; cv=none; d=google.com; s=arc-20160816; b=oATin83G46N8XsX9xYpmHIYp9nELHNGVajrNZE7wqfU9TDaTiAaF+4nOrX3tBzRbsE UjQ6TRZVjs42t/K2CqnzBkWrc13Wmr7D9PlO+mQG7JsX9Q/cG8bOAgE5huRPgGjGx2Cq RSeugQ44JjHukZGpu1qJ6A+bsFfv8P89PLMW9Ar+JiZhFEv+dxNLK/wtiysDPcmGWsRz qfA86fmpiWade94yu087Okv1UnFMzOYxLxrVrJn7WkvaKT2IgVFV2e3PVf+YOJZKxx1I zjm470Z5/jh5S+fMvZY1M6UQwvu81ab0EMnSMU2oq8lAEn8UtvDT2s9G54tztgytQItP GQ9Q== 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=/dXD0XWzs1cec8S7WXj5ILs/HnYK629EMvbNKRqQq+E=; b=uwGJY+EBt75f9lh7RJGskr0THqrcqkSiZr3ZeFJemkahpU5QV5bvtXW5kve26k8rhs ShlLRpLwK5vbvmDbXR5WUgMHUAKZers7IAqW31XhK5mm2fvv1kT/Bgzjy1FewtC4k+C7 FeJWuu4ImddC6DK4L5UJHbFtuTTQcvOO4PFg3YbfaCfJFBxl/gnvJbBpQYorwBEplgcx gMWbCohu8zjdlqU9vhucvuD2PogVLnR+6iVd+fgmFK5QnKGI4c9aYZxXGteFO/r6hqlh vhhNdejtRV7c28c7x/79PQfg+C02R+1EyGm1SXj8J+SsH49imUVWAWK1SICFkwswEHby u+Cw== 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 c20si864751wmi.218.2018.02.08.19.42.05; Thu, 08 Feb 2018 19:42:06 -0800 (PST) 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 1D208689767; Fri, 9 Feb 2018 05:41:55 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe02-2.mx.upcmail.net (vie01a-qmta-pe02-2.mx.upcmail.net [62.179.121.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D2AF56804C8 for ; Fri, 9 Feb 2018 05:41:48 +0200 (EET) Received: from [172.31.218.39] (helo=vie01a-dmta-pe03-3.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1ejzZV-00006Z-F5 for ffmpeg-devel@ffmpeg.org; Fri, 09 Feb 2018 04:41:57 +0100 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 1ejzZP-0004sL-FM for ffmpeg-devel@ffmpeg.org; Fri, 09 Feb 2018 04:41:51 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 8Thl1x01P0S5wYM01ThmGX; Fri, 09 Feb 2018 04:41:46 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 9 Feb 2018 04:41:44 +0100 Message-Id: <20180209034144.21288-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.16.1 Subject: [FFmpeg-devel] [PATCH] avcodec/vp3: Check eob_run 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: out of array access Fixes: 5919/clusterfuzz-testcase-minimized-5859311382167552 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/vp3.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index cf9c57f5fa..120c20f349 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -978,6 +978,9 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb, if (eob_run_get_bits[token]) eob_run += get_bits(gb, eob_run_get_bits[token]); + if (!eob_run) + return AVERROR_INVALIDDATA; + // record only the number of blocks ended in this plane, // any spill will be recorded in the next plane. if (eob_run > num_coeffs - coeff_i) {