From patchwork Sat Sep 30 22:30:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 44064 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1204:b0:15d:8365:d4b8 with SMTP id v4csp598833pzf; Sat, 30 Sep 2023 15:31:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IET6sVe+ZtQiZwB33uOC5wN77G7mzWJaTSn3nkrBdZ5Dku7f3PYGNjXQbi5klY8ryb7MVcc X-Received: by 2002:a17:907:b10:b0:9b2:78bf:d8d4 with SMTP id h16-20020a1709070b1000b009b278bfd8d4mr6142871ejl.5.1696113083170; Sat, 30 Sep 2023 15:31:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696113083; cv=none; d=google.com; s=arc-20160816; b=do2AFsPHxrFlxV2ne5+7bU+P7djOudr4lh2Vl/OXu5wEjE3MDJl2DMTOkkrchp+rI9 FyytdU5bzNRJ9v+fLP+4eE08n2jncYRr1RexZ5TQIfpOzzHbphRJ+nq7gEaXwgc09QeR eyCrHPILwEszuQ7OyF3H9RZ9mCi5G1ZUli9WKG9gw/U7HoQiw4TEMb+nHIF5W2qZ+V1t LN14VFca3OCmna3K/b+BsWO/WRqaAOKvL2b2lwoplFZyH3dFhSs09jJhU1GQpBMxYhff ujCg3ewZLIjtp33xz1oeC/xQyslXfRtHJEQtsEyCuVengF5YYQA41+/d4MuZ8f8nSXbO YZ1Q== 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:references:in-reply-to:message-id:date :to:from:delivered-to; bh=Pbi+g5qSDagWlwmW6P8A+dKtIENagx4CQPjc9ltby9k=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=kXt3IGtryoLQQquj1IHNMExZprQX51j3xOXwn6niOdv0uixtGYNqIK2o352SyAMZ0a sOJkFXc0GA9a7wE1OmtozP9PsmOw7u8GThfka7oz8Bi8uxuWHmBzYKBDErE7veAjpEA6 SlAa42bo6PczoiATaxf7l+g/nbo1OFECCGVGdDsiou8Z7lxd9M9iDFRjkafTdXoq8pcv 2SiB3ldvhKnsjQdm45lN6i+OuRkl1LSv9P+YWKqJFIzdmzw5nO54nt/odM350H/fhpEH 3qxZOziytaLvlEbARF45ed9J1hOxC5qSsHz5TQS9/eXPu4CFFdKPKm7FsfSuRpvOVkPb XoYg== 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 k11-20020a170906a38b00b009b2cfb2e67dsi2168392ejz.856.2023.09.30.15.31.22; Sat, 30 Sep 2023 15:31:23 -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 DA1FC68CD4C; Sun, 1 Oct 2023 01:30:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5589D68CD49 for ; Sun, 1 Oct 2023 01:30:51 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id A0DB81C0006 for ; Sat, 30 Sep 2023 22:30:50 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 1 Oct 2023 00:30:35 +0200 Message-Id: <20230930223046.22896-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230930223046.22896-1-michael@niedermayer.cc> References: <20230930223046.22896-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 04/15] avformat/jacosubdec: Check timeres X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: D0zVn+lZCiHd Signed-off-by: Michael Niedermayer --- libavformat/jacosubdec.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c index 41216081ee0..c6e5b4aa6dc 100644 --- a/libavformat/jacosubdec.c +++ b/libavformat/jacosubdec.c @@ -227,14 +227,17 @@ static int jacosub_read_header(AVFormatContext *s) } av_bprintf(&header, "#S %s", p); break; - case 'T': // ...but must be placed after TIMERES - jacosub->timeres = strtol(p, NULL, 10); - if (!jacosub->timeres) + case 'T': { // ...but must be placed after TIMERES + int64_t timeres = strtol(p, NULL, 10); + if (timeres <= 0 || timeres > UINT32_MAX) { jacosub->timeres = 30; - else + } else { + jacosub->timeres = timeres; av_bprintf(&header, "#T %s", p); + } break; } + } } /* general/essential directives in the extradata */