From patchwork Sun Feb 25 23:23:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 46527 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c51b:b0:19e:cdac:8cce with SMTP id gm27csp1075147pzb; Sun, 25 Feb 2024 15:24:13 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWUb7+OPvmi67hW/ey9aG1Yirm4Nat8R9kFDYqQ6EamPTTjuvsurBNm/mGCK6TuWfbGtExkwOlZYNLEuwf1wmjrl1OeJCsPFTlUaw== X-Google-Smtp-Source: AGHT+IGrOvQtdTRY9cZ4ImHGU+cHBoOcWXnbRZ7WPFxSXjT/ZHlGrqnn1K2kbsVfe+8n9HdoBzVH X-Received: by 2002:a17:906:3487:b0:a3f:daf8:bd3b with SMTP id g7-20020a170906348700b00a3fdaf8bd3bmr3464746ejb.8.1708903452796; Sun, 25 Feb 2024 15:24:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708903452; cv=none; d=google.com; s=arc-20160816; b=MWwKhHFmnjPlx/EnTKR+3ixig8EWHkDzxZ1zNwXCWq67lahAFJGFwjSRL7BRLGN05K T/1gmDBHnUBG49Ft3tbAvBip/+KjIaXh9Vohhrl1jn/eX3Y+P6iCszZWILIDhL5xYmAA 8JYoi/RtSqVl53qFW+N+QGrJEwd6rWOwqVfiyHjsuh9fVuws+Ikiake3u8bBAau2M8GA PT308kxWwuepIVtEc7UVeNQCNnBYOfVW4k+96OI9f3jhek+rPT3j+qV5YTt4DPe6gQtb 1oyuI88dJi+olHe7ga2HBElBfyQ7W469rWFmS7caRZIMU/UWznCS6QEfT1NP0oFPjHJ5 1ejQ== 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:dkim-signature:delivered-to; bh=Bo2JgHy8FvjY/pYqFT731Ousol4IT8+EtnNiEgWbwVw=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=0/YLugAEbbK7/NvKHa5W3QaoMACEIWQftVgIg1NnzahIhV5UTlpAuJ5nzVFLHkqIT5 kPY0owBtcm2wUIY1u6Az2dX+aKuOTLemuJM6Y3aV0jQUyZ3NqnffiIco28ugQ8Xxwx3c H7xlpXAYQmPRNRCYqT3va6FjblHrnKRkbemADGOJb+ycYyd5RzpBeHvVIBLOTIAyFjHo f8VFVs2lQ2kyV6IM2/YtZHTdAJcGizEA7mCVlIG1G0UyXiulAlPLIaDZVTA+Z9S35QmB PLzs5t82qIthjlVPBu08jyek5v+BkWrW41SiPxLwwqEbLrFvun3lJHYw+Z26dylkBzQe YvkA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=ITM91vQK; 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 ck19-20020a170906c45300b00a3f0ec2071asi1478172ejb.220.2024.02.25.15.24.12; Sun, 25 Feb 2024 15:24:12 -0800 (PST) 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=@niedermayer.cc header.s=gm1 header.b=ITM91vQK; 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 6BBD268C7C3; Mon, 26 Feb 2024 01:24:05 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 250F068C775 for ; Mon, 26 Feb 2024 01:23:56 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id 51EC5E0005 for ; Sun, 25 Feb 2024 23:23:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1708903435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:in-reply-to:in-reply-to:references:references; bh=t9TCxZYpK4M4jrnfecM9bimTbEs6PIjA4ETGWOvHxrM=; b=ITM91vQKlZD5VnRlw/Lf1N49CXjaHBoZ3En+Xb9g5+bQ62DMJCXNozJ4g75+oRzLxmq/yC QnZhfxV9LBn3n3lZIjVkrRlco742tO5vrnwLJIE6W7BRy0r6SYpZl8IyCk83vAx7C4mkYN 8vwXvTbGriVrhaEyVAmZSHVrC8p45ExPTxNFVi00ecigfacUWWCjo8TCi+m6Jt5e897vAL +HCDJyzwj6iZAxibMX8oHWk6gbFkdGqHl/t2AcNWl4eVwWxkOOmYtDgkLyslVL7qP0YKcm zN5prwNAsLU6Qh2+j2XSoxpHERa1bcnFBmHUFHXd4SiU/lPVwl9wWBzadZZzyQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 26 Feb 2024 00:23:53 +0100 Message-Id: <20240225232353.23735-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240225232353.23735-1-michael@niedermayer.cc> References: <20240225232353.23735-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/2] avformat/concatdec: Check in and outpoints to be to produce a positive representable duration 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: M4wCOkVBewLN Fixes: signed integer overflow: -93000000 - 9223372036839000000 cannot be represented in type 'long' Fixes: 64546/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-5110813828186112 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/concatdec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index ffa8ade25b..7abe03c26d 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -638,6 +638,12 @@ static int concat_parse_script(AVFormatContext *avf) } } + if (file->inpoint != AV_NOPTS_VALUE && file->outpoint != AV_NOPTS_VALUE) { + if (file->inpoint > file->outpoint || + file->outpoint - (uint64_t)file->inpoint > INT64_MAX) + ret = AVERROR_INVALIDDATA; + } + fail: for (arg = 0; arg < MAX_ARGS; arg++) av_freep(&arg_str[arg]);