From patchwork Sun May 21 13:34:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 3707 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.10.2 with SMTP id 2csp1039017vsk; Sun, 21 May 2017 06:34:38 -0700 (PDT) X-Received: by 10.28.1.198 with SMTP id 189mr11055429wmb.18.1495373678055; Sun, 21 May 2017 06:34:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495373678; cv=none; d=google.com; s=arc-20160816; b=KMSS7GoH3aQr6IVm8zj041SWWVcMZj+klWKGFtlE93uy0QRADQdrB2T6WHekyJbMoC GRuNdqZDlMfBjhwQXoEUdL8GIY/Cp+xak1F+dC/IYWCnX7qLQx0D8yKk1L3wPabTuUST JqMBNOsjEIvBghHu0TfbXjerRwRS0RzkZpMEQ+/rd1c10XWCckNbskMS26SnPcadrVI/ Udbeu5/8Bmdg+Lh1Bb8z1op1T7U1m161/0y0AqcTXgbV3ehyOCAjkXWydDCTBWJbiOrO pRoC99EuCwpFeTbkDw2LcIE/PngsIGeUM1fIrzVc3t3ZgWTKTJmwsNlbZuE3JeYPUG3j CEJg== 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=spV8ZrG19qLe+JrLGk5qyk12mSKnkdwzEoI/k25qf1A=; b=xdSAz9RaeseWrN2/771Zp1nbh2MTE3yv4RKYYg4l+5QlRBTC3obgd/KuaGqCROw/ab okZjzZHqZkL64BB8tXQZSwi4IfW6xQzGdLK3rNQ7FXC3RSryOqlmTZvOcODulNvcY5aa 5No4VdggXigPFA2zsUCPEZPnzyb8tTiJdjWJ1Fsp5+101Xs9CfY+y+m4EEU7MDJCgy3H +5SesOG1EwI9NjI7kBvuvezmfGuwAZoFW25ap8176DWBCe8CvsmBQLteeVue8IrTJ4mX KhF/Oh679b7prTiqkaT+yMeGumGpSuz94WQ7T803OgKetGtd/v2F0ixnl6PRy5x6I67T pmhg== 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 189si4772365wmq.2.2017.05.21.06.34.37; Sun, 21 May 2017 06:34:38 -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 25E2368988C; Sun, 21 May 2017 16:34:33 +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-pe08-1.mx.upcmail.net [84.116.36.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C027D6882BA for ; Sun, 21 May 2017 16:34:26 +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 1dCR06-0000VK-LF for ffmpeg-devel@ffmpeg.org; Sun, 21 May 2017 15:34:26 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id P1aM1v00m0S5wYM011aNTA; Sun, 21 May 2017 15:34:22 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 21 May 2017 15:34:21 +0200 Message-Id: <20170521133421.29589-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.13.0 Subject: [FFmpeg-devel] [PATCH] avcodec/tscc2: Skip duplicate frames 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" This turns CFR duplicated frames into skiped frames Fixes: Timeout Fixes: 1719/clusterfuzz-testcase-minimized-6375090079924224 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/tscc2.c | 13 +++++-------- tests/ref/fate/tscc2-avi | 8 -------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/libavcodec/tscc2.c b/libavcodec/tscc2.c index f64c76507e..a8c7ee7996 100644 --- a/libavcodec/tscc2.c +++ b/libavcodec/tscc2.c @@ -235,18 +235,15 @@ static int tscc2_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } - if ((ret = ff_reget_buffer(avctx, c->pic)) < 0) { - return ret; - } - if (frame_type == 0) { - *got_frame = 1; - if ((ret = av_frame_ref(data, c->pic)) < 0) - return ret; - + // Skip duplicate frames return buf_size; } + if ((ret = ff_reget_buffer(avctx, c->pic)) < 0) { + return ret; + } + if (bytestream2_get_bytes_left(&gb) < 4) { av_log(avctx, AV_LOG_ERROR, "Frame is too short\n"); return AVERROR_INVALIDDATA; diff --git a/tests/ref/fate/tscc2-avi b/tests/ref/fate/tscc2-avi index 6f0e8a53d3..09ed897337 100644 --- a/tests/ref/fate/tscc2-avi +++ b/tests/ref/fate/tscc2-avi @@ -5,33 +5,25 @@ #sar 0: 0/1 0, 0, 0, 1, 230400, 0x7a2103c0 0, 1, 1, 1, 230400, 0xd381c279 -0, 2, 2, 1, 230400, 0xd381c279 0, 3, 3, 1, 230400, 0x110aec27 0, 4, 4, 1, 230400, 0x4be67ee7 0, 5, 5, 1, 230400, 0xd87fe4b4 -0, 6, 6, 1, 230400, 0xd87fe4b4 0, 7, 7, 1, 230400, 0x9bc6a398 0, 8, 8, 1, 230400, 0xd67d92db 0, 9, 9, 1, 230400, 0x3df6559e -0, 10, 10, 1, 230400, 0x3df6559e 0, 11, 11, 1, 230400, 0x2136ff25 0, 12, 12, 1, 230400, 0x94573fe6 0, 13, 13, 1, 230400, 0xbf67d3f5 -0, 14, 14, 1, 230400, 0xbf67d3f5 0, 15, 15, 1, 230400, 0x2592b5cf 0, 16, 16, 1, 230400, 0x5b23cd93 0, 17, 17, 1, 230400, 0x9b76d079 -0, 18, 18, 1, 230400, 0x9b76d079 0, 19, 19, 1, 230400, 0x771a017e 0, 20, 20, 1, 230400, 0xacfee1d0 0, 21, 21, 1, 230400, 0x6b9ff4eb -0, 22, 22, 1, 230400, 0x6b9ff4eb 0, 23, 23, 1, 230400, 0xbaf643e1 0, 24, 24, 1, 230400, 0x052efe59 0, 25, 25, 1, 230400, 0xd751f901 -0, 26, 26, 1, 230400, 0xd751f901 0, 27, 27, 1, 230400, 0x6f94e11f 0, 28, 28, 1, 230400, 0x17eeabb9 0, 29, 29, 1, 230400, 0x3733a035 -0, 30, 30, 1, 230400, 0x3733a035 0, 31, 31, 1, 230400, 0xb0829f45