From patchwork Sat Jul 3 21:02:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 28750 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5d:965a:0:0:0:0:0 with SMTP id d26csp2797805ios; Sat, 3 Jul 2021 14:08:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXeijV+GxTJm47uARZ8cLhzdPNvgshqcc7y+7EuCc4Jn5nBNbk4X5BBnYESzW5nGYsTLRh X-Received: by 2002:a17:907:a088:: with SMTP id hu8mr6137178ejc.353.1625346529231; Sat, 03 Jul 2021 14:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625346529; cv=none; d=google.com; s=arc-20160816; b=FpuGn+HN39BxDdA4aJy0haJhs4ehQiqpBm5rjrR1rHtxLqbOWow7GUgUeUj/FHpHkX yxuI1pKt34FVE9trC6jWQvoVYyFlZYlAWGksIx8cDyZFhaXzf4SGxfhjA7HFdSiO3nXz c+PjLBtGq6pYB62+2kms7obRlNvMyN6j6qnrr9E9N3Q341LZV1uBLn9lUhmC009S+928 Pcv4dPMJko1VyIVySev+ZzmiZkiv/EjbpfPbz2GrwCtbiOg0AHqqZTooMcF+7PoJfPqI lq5zXg2Gt4gLfg3WDUkFdSJz6Iw2oNfdf1Rf/ZeDKVDYw/OPN42loojcdD6SH8vjVH/U FSnw== 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; bh=CQlU1vaqT89XO4SbpBfSECjx+M0sk0c/7IkAnm3eSgA=; b=G7ucY1hzr4sajq5GK+igSkoa6TH1uU6XsFAx47W7/zNpbBCz3/BO1rd8Kjm9z/r+gd VYM6nke1aS4RRz6zan+ga3x94KZVbUkGKOw7NzU+GcRSmdn89OGNz8ulZuR4vCiNcy17 PGcl/4iWol97RG378DL7Rwe7x8be/+1dXNApPEY3Rc/ygYAwAVQa6nyhRHkyy7yM0srk pFtxzduXUvUMKcrijvJrc6IbIil2G7Ossp/vnAwNdG74yWvQlmu1B/uaAfSeenme0Dv/ lpVLD2tsHGV4N/fs5JxvuAD4Vd3Uv0LLLOr4KN6+wTVPoh28zVaNDOLvWP5ay9mVXO9/ E2dQ== 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 h20si6920626ejl.315.2021.07.03.14.08.48; Sat, 03 Jul 2021 14:08:49 -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 B8281689916; Sun, 4 Jul 2021 00:08:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-3.mx.upcmail.net (vie01a-dmta-pe03-3.mx.upcmail.net [62.179.121.162]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0B80A689916 for ; Sun, 4 Jul 2021 00:08:39 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1lzmnF-001pse-0C for ffmpeg-devel@ffmpeg.org; Sat, 03 Jul 2021 23:03:17 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id zmmGlCnJaljeHzmmGlDbot; Sat, 03 Jul 2021 23:02:17 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=BoHjPrf5 c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=nZOtpAppAAAA:20 a=iOEUGmBRcNTOwCozQ_0A:9 a=1fhp2MxaeJtTNGEnv6mo:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 3 Jul 2021 23:02:16 +0200 Message-Id: <20210703210216.18186-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4wfMasPAj0MYeTIPLNvhDu1KElNTJrYrs3JLtTqpbZOBnFe/NSZv8ied08ZQApjnsOKI2jjU9sqxEzIGPMrmfppr+mKAdGZXuNAYVzKmJprSh/mKA4kws6 IoVOT7toVw21Xsz3AHmFBRmmB1YM2/KQM2man70i2oA4dbS/bYzZuvUO Subject: [FFmpeg-devel] [PATCH] avformat/utils: Ignore negative duration in codec_info_duration computation 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: zCcuMWdZAEPD Fixes: signed integer overflow: -5994697211974418462 + -3255307777713450286 cannot be represented in type 'long' Fixes: 35332/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-5868035117285376 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 0df14682a4..2974f3739e 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3842,7 +3842,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) av_packet_unref(pkt1); break; } - if (pkt->duration) { + if (pkt->duration > 0) { if (avctx->codec_type == AVMEDIA_TYPE_SUBTITLE && pkt->pts != AV_NOPTS_VALUE && st->start_time != AV_NOPTS_VALUE && pkt->pts >= st->start_time && (uint64_t)pkt->pts - st->start_time < INT64_MAX ) {