From patchwork Mon Apr 2 21:24:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 8291 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.1.70 with SMTP id c67csp2963677jad; Mon, 2 Apr 2018 14:25:59 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+S70aGwCTYkoRIYz8hzEWF+I/lKWWY/Vw0OCrmdFme9mFYvcnkAkGhlVatamfOlIif6Ucl X-Received: by 10.28.62.16 with SMTP id l16mr2175220wma.54.1522704359609; Mon, 02 Apr 2018 14:25:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522704359; cv=none; d=google.com; s=arc-20160816; b=GJOuAGw/4BGupuRJhxPBVw0ypc/G6mhPGHvmZ0aAZEIpASPXgyIxEOPNxelHdaoOAO 67UG3qpsYHuk5YW3lNv1FNru94Cc5O9B2rYXbX/VVkfIV2ur6Et2/x7KvHAcaoiP+1ew 0+EEhC3CDUq4yOqaCVfxOsgCDuRJ1PXD1u0izqCNp2wkmofWUf22MBUUDL0/NV/bzZE2 Awr2JNi7zPE9c9sqx4F1PU8MKJ+W7RZ/cWBziFCTT39UVBpt7F750yzFibjnMUhtIIvy YuuJivBnhXnr8MvyjQ+arMXeRcYZdNWiso4clgGGccpx27+nRFw8PiFIZSU4ieoxbHUR nJdA== 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=ojRNFwHSwgexMMutyGNbwHrSomHF9wwKBIoOnk0FjBg=; b=U70/GnLcXqntZmGDBoHSSNvGE6VAuWPCjH3ecxoLoN02RdwmDeo11MsalOjx4asBIG ujGi45rA82Dq2pjMb3visMyLWci8ZnL93nediD+3wcQZbadXvQh28REKQCPXwp01fSHE FC5Li5yQimv+tnI8KLrISZ2gQuYDaQCA7g51ew+BUmOAoVcEaXeGX8GeuzRbBzIUDEOX hD7FL4+wf5JVTEAVoB9ZlOnpqrkajzpge1kzVlBEW6Tke0BqVWUUYESCenG4in4Nqxdb 7zGm5IzPZ6bxyOm5Pzu6NXkgsYWyyMHhSKnWg+3hfVu0hh57XUt6tg6CM9jPZT2d0XF7 kKYw== 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 w4si976725wme.145.2018.04.02.14.25.58; Mon, 02 Apr 2018 14:25:59 -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 6A414689255; Tue, 3 Apr 2018 00:25:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe02-3.mx.upcmail.net (vie01a-qmta-pe02-3.mx.upcmail.net [62.179.121.183]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7E890680BEE for ; Tue, 3 Apr 2018 00:25:30 +0300 (EEST) Received: from [172.31.218.44] (helo=vie01a-dmta-pe05-2.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1f36xa-00085z-6D for ffmpeg-devel@ffmpeg.org; Mon, 02 Apr 2018 23:25:50 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe05.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1f36xU-0007z6-C0 for ffmpeg-devel@ffmpeg.org; Mon, 02 Apr 2018 23:25:44 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id VZRc1x0060S5wYM01ZRdfb; Mon, 02 Apr 2018 23:25:37 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 2 Apr 2018 23:24:59 +0200 Message-Id: <20180402212459.22139-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.16.2 Subject: [FFmpeg-devel] [PATCH] libavcodec/rv34: error out earlier on missing references 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 visual corruption on seeking Fixes: downloadTest_clip_24M.rmvb Signed-off-by: Michael Niedermayer --- libavcodec/rv34.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index f1495fb5a8..d171e6e1bd 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -1585,7 +1585,7 @@ int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecConte // Do no call ff_mpeg_update_thread_context on a partially initialized // decoder context. - if (!s1->linesize) + if (!s1->context_initialized) return 0; return ff_mpeg_update_thread_context(dst, src); @@ -1733,6 +1733,8 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, if ((err = rv34_decoder_realloc(r)) < 0) return err; } + if (faulty_b) + return AVERROR_INVALIDDATA; s->pict_type = si.type ? si.type : AV_PICTURE_TYPE_I; if (ff_mpv_frame_start(s, s->avctx) < 0) return -1; @@ -1786,8 +1788,6 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, "multithreading mode (start MB is %d).\n", si.start); return AVERROR_INVALIDDATA; } - if (faulty_b) - return AVERROR_INVALIDDATA; for(i = 0; i < slice_count; i++){ int offset = get_slice_offset(avctx, slices_hdr, i , slice_count, buf_size);