From patchwork Thu Sep 5 20:16:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 14933 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 3A32744879C for ; Thu, 5 Sep 2019 23:24:14 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 13BEB680AD6; Thu, 5 Sep 2019 23:24:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8A9926809FF for ; Thu, 5 Sep 2019 23:24:07 +0300 (EEST) Received: by mail-wm1-f65.google.com with SMTP id k1so4215698wmi.1 for ; Thu, 05 Sep 2019 13:24:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sFnZtzM6u1h33ZNhFeNQQjs2tOpjaZsE/0GJ6d3c6Ho=; b=BnfxJHDRP+sw2Q7pCiZ7+CiFAwte59lpPEV+eQTQrqnzsECNXFdWIfRCTI1WHnShXe USlDIojjFZYCPTMtaJLeaiS9YnPBgIDNf90WKWzXpim6eR/hlPFAx0XUSwGrLY6nc4PW 4iCcGJEvNHoj5tXjOjPAYCAWQjdWdw/ILTYFGPj543ZZaTcfN2WvJvHJi9HbXa3wb0lY OPyFUPXdyBHs6ZDEKSKQtnbhEXCA+6u3dZcKxG+79kW+MJyQkXDlIoZxFztQqoOFXtlR +FFobEdiHBGanxL1+w8wiTbxDggE0XkTYHI9ITkCGA+QiD39mQvjApAorHR7KNNjvbBi 1UJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sFnZtzM6u1h33ZNhFeNQQjs2tOpjaZsE/0GJ6d3c6Ho=; b=DfR1KZ3hlJkJqVtJzkOzu6zk3BqwNNwtfOrR8o2enfvLQinRG+C9ATJWTrcpbyPCut 8rE7ud3wNA0jcr/kr4tzBOX8zv2JXS/Xid2AwdJxShKHcbXolY7IdqSGBeGB1QqdHqwL /4XqTPR23CtbG7A5YB3Jy/RpEVHyivZ1lFfrfNAuJmlniLRHYa1VEhZs6wod0TAb9ST2 eqFcyZ+HKNwfA43nigsZvmLOb8RJXD56pRim3Dn7BuwUjCrvyG44xUMOL/vwy8aDZCVr EDRMKvOkISSaVzSFq1dv8KcHxNb7TlLs9xMU8NN8DVJ/cU/ckWm+Owz87kpcLKtWEH1j /C0Q== X-Gm-Message-State: APjAAAVEi+ItvGW7x40I9R5IGkMkbszZySb9SWuyFXMhFGTRIopSI+Er j2mT1PPL3ZTF5K4xkq9QW9AAoecXFSI= X-Google-Smtp-Source: APXvYqyvAWg1bzKChhl/zzlnKMnqe8LOf7KenCmuBW450LBlAbfxqClipc3f50tChfTslBvjENPt8Q== X-Received: by 2002:a1c:be11:: with SMTP id o17mr4336994wmf.1.1567715046738; Thu, 05 Sep 2019 13:24:06 -0700 (PDT) Received: from localhost.localdomain (ipbcc0f857.dynamic.kabel-deutschland.de. [188.192.248.87]) by smtp.gmail.com with ESMTPSA id g201sm5889769wmg.34.2019.09.05.13.24.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2019 13:24:06 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 5 Sep 2019 22:16:04 +0200 Message-Id: <20190905201609.998-3-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190905201609.998-1-andreas.rheinhardt@gmail.com> References: <20190905201609.998-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/8] avformat/matroskadec: Fix handling gigantic durations 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" matroska_parse_block currently asserts that the duration is not equal to AV_NOPTS_VALUE, but there is nothing that actually guarantees this. It is easy to create (spec-compliant) files which run into this assert; so replace it and instead cap the duration to INT64_MAX, as the duration field of an AVPacket is an int64_t. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskadec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 47386b2631..bdbddb58a5 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -3565,7 +3565,8 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, AVBufferRef *buf st = track->stream; if (st->discard >= AVDISCARD_ALL) return res; - av_assert1(block_duration != AV_NOPTS_VALUE); + if (block_duration > INT64_MAX) + block_duration = INT64_MAX; block_time = sign_extend(AV_RB16(data), 16); data += 2;