From patchwork Sun Jun 24 02:46:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 9486 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:141:0:0:0:0:0 with SMTP id c62-v6csp2635042jad; Sat, 23 Jun 2018 19:47:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfNadFhCYEyDwF9FxkKAB0KE7fbP5crS6pDDlhtwAD1CQkDqdLpp/uULvJIYpDz4Rd1WzLM X-Received: by 2002:adf:dc52:: with SMTP id m18-v6mr6357239wrj.84.1529808456468; Sat, 23 Jun 2018 19:47:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529808456; cv=none; d=google.com; s=arc-20160816; b=TU7LQm3ERy3XzfFxk99EXWLF6nCYKd34GKU3pI5We3FtmyU+i/Z2krYkMIjPW7LfRa ADRYGwWLqpysVBchOToxiJonfw+0Q61+JtePsmLo2EIaRrnE7nZxmBhGF5rdy2kX6t0Y 9PlTempsEtKXubkZHaqkvAgF7SLtDjji1y97B4nLrVEl3otM4q1KPwldfZGmhRo/LmC9 GvdszE/v0lRcCXHpl8PoOK0drTXxhl+XyedG0p8j+fTiKwB6Yo7ueOQS92mRBjNb7XBt ki9RWm2Sty7DCfie6eEZVQHLiBDbL/OhFcLQ7L/NNuNUq8M4FslgCcciNeRIbt1ktIJP 0yLw== 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=y6mGygLOum5EZct0SZw4+m3wmS3JmFWObPT4m5p0AZo=; b=KT1ZVJS6R/rZkqBv6yqd+8DgF7Yb28FsSruXHBeoJjPhjnVM3Qib+vp+F96dCVdp53 LWoGPdeCh8my012T48z+i3NXQ+5HSdm/l8dsBQciCi1YHUn6lrIuAzNlohP0CzA/COTN krZqEWZ4ZQ13KcXPyMEe8EU4KZecBl0BA+JiFIvU46t7NZh31poWx/K3ZVjQ+Nlcft1X FsvRhMnq6NJf8H0Og8bESPVGYcjnYPLC7SDzlwqF+zEXYZBUBaEVQ7i14zQ6eJQe8J6t ghw+PsEkAdijZ2hmZqjIlD793wb8IriVZHKc8yhPLYjBBPm/SWc8W9rzm5B6kPessBM4 3q6w== 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 q5-v6si571478wme.187.2018.06.23.19.47.36; Sat, 23 Jun 2018 19:47: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 1E26068A2A6; Sun, 24 Jun 2018 05:46:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe08-2.mx.upcmail.net (vie01a-dmta-pe08-2.mx.upcmail.net [84.116.36.21]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F36D1689720 for ; Sun, 24 Jun 2018 05:46:16 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe08.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fWv3X-0005LN-Hb for ffmpeg-devel@ffmpeg.org; Sun, 24 Jun 2018 04:47:11 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 2Sn31y00g0S5wYM01Sn4Ab; Sun, 24 Jun 2018 04:47:04 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 24 Jun 2018 04:46:22 +0200 Message-Id: <20180624024623.26645-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180624024623.26645-1-michael@niedermayer.cc> References: <20180624024623.26645-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/vp8: Check bitstream input in vp7_fade_frame() before time consuming operation 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" Signed-off-by: Michael Niedermayer --- libavcodec/vp8.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 62b9f8bc2d..f6120aa67e 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -505,6 +505,9 @@ static int vp7_fade_frame(VP8Context *s, VP56RangeCoder *c) int beta = (int8_t) vp8_rac_get_uint(c, 8); int ret; + if (c->end <= c->buffer && c->bits >= 0) + return AVERROR_INVALIDDATA; + if (!s->keyframe && (alpha || beta)) { int width = s->mb_width * 16; int height = s->mb_height * 16;