From patchwork Sun Jun 14 22:36:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 20354 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 8DDC8449042 for ; Mon, 15 Jun 2020 01:38:07 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6FB7268B4C3; Mon, 15 Jun 2020 01:38:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 76EA168B20F for ; Mon, 15 Jun 2020 01:38:00 +0300 (EEST) Received: by mail-wr1-f68.google.com with SMTP id x6so15129238wrm.13 for ; Sun, 14 Jun 2020 15:38:00 -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=BU6SEaO6dgs6XY5KfDUDL9jXBxUw97trgTDx7tId8Wo=; b=RUPL4/RftuzKlGVUJqrWyAnlFl0d2f2D6mynDcOuHb/jEbewFyhx2nz/GAZePuWxmr 14HfMSN1YQC384yEx4VbflSD3HnqeI4xQOeXZB6Yj8ypsYDDuUc5k454zsyGAD3Y73xx UawmrlEb4fNw2s6esLLDAxZm4d/2mw30dTinHFP0d0O4U9YntGBdxh0GIi7NtZ1QFqd1 HzZIBeu8r/KbaG/dt4yLk1js4P/S999jZj2/gtWkDDuU1C4yik2qC14jlD5ofuxij+jr vMZJAr61XALj0/VSIr1xiGxe47Azz1WCBIBD2VjyRdJ9X3PJlPpPzZdoOz+qMNz/Q6l6 WOfw== 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=BU6SEaO6dgs6XY5KfDUDL9jXBxUw97trgTDx7tId8Wo=; b=XeLjronKovEYFkgfgdIkNLMpAMHwk4QaGGNQ4/Tnnc6j3D5WoXT9n+Mf/VLkYkizmt etwM/70aX3yt5CpnIDC6d6aypyPhP7p8kZA1zWFDl9VDEerP2rU1LCXHN0glPOngDcKt KOrgZHRD4YododWQFd1BpZ2UrHcVmW9EGrhNbxZ9H7bA1fyIuEgKB3DMUR/ugXXGPVFd R1PwjjLAUDffGXbsEpZva897OOWZaG3MKTGPgXNX2Hgj2D4y8lFxv9xBCGrl9gPtGK+A +UjMY0MVGGvEelJtTeq0Ta5+fLpXYombPLyElHRdL32QDK0wTAPO3n2+6CMer7ZI8MrB qSCQ== X-Gm-Message-State: AOAM533FNdbvWIlkAj1T9/4HEmeluh8OYV/ud/80YQAzoXxoj/i2RPOq 31bLdFcjrLkX5bm92d9Q4QpyoUOp X-Google-Smtp-Source: ABdhPJxrLeIGW2V5Bg8NiOnExc1jxq2xPZ9rk6Hmm5aRjDRxINaTbycVZ+mkVNnQICMyzuk47LTpuw== X-Received: by 2002:adf:f84d:: with SMTP id d13mr24040764wrq.99.1592174279742; Sun, 14 Jun 2020 15:37:59 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1ab57.dynamic.kabel-deutschland.de. [188.193.171.87]) by smtp.gmail.com with ESMTPSA id z8sm21491034wru.33.2020.06.14.15.37.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 15:37:59 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Jun 2020 00:36:32 +0200 Message-Id: <20200614223656.21338-2-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200614223656.21338-1-andreas.rheinhardt@gmail.com> References: <20200614223656.21338-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 02/26] 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 b1da40983f..1846b1f93c 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -3568,7 +3568,8 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, AVBufferRef *buf 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;