From patchwork Sun Jul 31 17:22:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sophia Wang X-Patchwork-Id: 41 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.67 with SMTP id o64csp2329009vsd; Sun, 31 Jul 2016 10:23:08 -0700 (PDT) X-Received: by 10.194.149.176 with SMTP id ub16mr47021780wjb.54.1469985788547; Sun, 31 Jul 2016 10:23:08 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i2si12441225wmd.60.2016.07.31.10.23.08; Sun, 31 Jul 2016 10:23:08 -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; dkim=neutral (body hash did not verify) header.i=@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 074AC689C5D; Sun, 31 Jul 2016 20:23:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B4EAB689A7C for ; Sun, 31 Jul 2016 20:22:53 +0300 (EEST) Received: by mail-pa0-f47.google.com with SMTP id iw10so45193356pac.2 for ; Sun, 31 Jul 2016 10:22:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=p9RMENnBf6aobx1yRV1RVmgFuNS2/0gG9bZi8TbtBNI=; b=Goq+ZT5YHGHVC4Txth8fHukm8/NGxtY+89lIhbbmv2GrXMPA0q1RSxYmPRnp3QNvpO LeKPofoZowfPopNpfz95MijY7xAlFtZTWTd6X2eyVMpv8M551nb3jRW89NIi/Fk5OiGm jrOu20eaWLgZ+u1XVZ3nJVoQ6YKBWWIiaZtsW+wobUgo9z4Zb+KGvBqGcvp0WowIue3y TLOuN/rYS7d66umADRfgLI3UKZGEj6OPOae8LnBVkB4CQsFQmtAllm6Y7XDlD+Dy2iMB 0xtloQinAeDYSYpPJyHv1zRJFiVUv0UMwvHbytvv+HDduSpFYQfx0w1ivgME7+0SJxJw V4Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=p9RMENnBf6aobx1yRV1RVmgFuNS2/0gG9bZi8TbtBNI=; b=kXDONvOLsFGa7emDAdI6K/sQ8r5LIP+sBe/RxLUaMKzdwW+3cyRWC4xWG3YHNZWc7o MZLZKOdyW3Nf1sY12C2Uf4i/9XkReUz2PiMkm25yE0gmbVWpTwutaxAwWjV6CED6yQt2 DiyakHJwcnNXKWs3+FjAx0x2rh8dbpgjP3Xd7TK+mW1+wsCjC+rzCw1NUCSGltDl64xJ Wm+4z2Y2+ppAmzaqXJBy0vg2pTDWAp5+lO7XCyUStlGtS+AM5pbcjFSjDTEeDOWJXn+T aoMMN0Tl5lt11wz5TPVfwYbzCKAUe1QCMpr86C4LsSNPgbiZlZMAtK7oXJDCt3sAB6/z rb4w== X-Gm-Message-State: AEkooutt8Ggm1gQfux4fFE+QxyawAvWK9qKta1IBPSmcnwfl8RmTTzbNKBetPY3SZ7kW76VW X-Received: by 10.66.15.138 with SMTP id x10mr86989255pac.92.1469985777503; Sun, 31 Jul 2016 10:22:57 -0700 (PDT) Received: from skw0.mtv.corp.google.com ([172.27.82.56]) by smtp.gmail.com with ESMTPSA id f6sm39417656pfa.17.2016.07.31.10.22.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 31 Jul 2016 10:22:56 -0700 (PDT) From: Sophia Wang To: ffmpeg-devel@ffmpeg.org Date: Sun, 31 Jul 2016 10:22:24 -0700 Message-Id: <1469985744-30271-1-git-send-email-skw@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1469222229-76207-1-git-send-email-skw@google.com> References: <1469222229-76207-1-git-send-email-skw@google.com> Subject: [FFmpeg-devel] [PATCH] avformat/matroskadec: return AVERROR(EIO) rather than AVERROR_EOF on parse error 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 Cc: Sophia Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Since matroska->done is only set to 1 in matroska_resync(), the choice of error is made by checking the return value of matroska_resync() rather than checking matroska->done directly on the next while-iteration. Signed-off-by: Sophia Wang --- libavformat/matroskadec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index f3d701f..ed28a90 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -3322,10 +3322,10 @@ static int matroska_read_packet(AVFormatContext *s, AVPacket *pkt) while (matroska_deliver_packet(matroska, pkt)) { int64_t pos = avio_tell(matroska->ctx->pb); - if (matroska->done) - return AVERROR_EOF; - if (matroska_parse_cluster(matroska) < 0) - matroska_resync(matroska, pos); + if (matroska_parse_cluster(matroska) < 0) { + if (matroska_resync(matroska, pos) < 0) + return avio_feof(s->pb) ? AVERROR_EOF : AVERROR(EIO); + } } return 0;