From patchwork Sat Sep 30 22:30:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 44061 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1204:b0:15d:8365:d4b8 with SMTP id v4csp598688pzf; Sat, 30 Sep 2023 15:30:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEG3dbEnMA/LrfccqCaYdP5JfBJs8EBrTnmo7BdWaiXb70V6DNCXGQyyu/zP/tTsFs5UYbv X-Received: by 2002:a17:906:f55:b0:993:fba5:cdf1 with SMTP id h21-20020a1709060f5500b00993fba5cdf1mr6013537ejj.22.1696113056348; Sat, 30 Sep 2023 15:30:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696113056; cv=none; d=google.com; s=arc-20160816; b=FEmEGJx7jsAiCE+yK+D7oGGCEQ6wjx3Zh/VHODpdJqlCADJmnu3PewfGOSvTcUmUY0 votgI+USMaOHy8zfW9C58w4sYXoIZjKMttCKcG81psy6Hd9PwOa0zMJQxD6omCKismou ZGlkajDsPQfYvHhZEGN8e1t63XgmHvQ0oo0y6qeJ7O9k30tITEhAwX4yhlklclP83ijN MpGKuJIAFRUSV6Y4572LUjYTd78OtZqupgEklT6fDWHU1Fi6BU4VGDM6fsrrXcIfpw9f j9PK9MlqGcMwX8HSVcR/CFYqQuPEnQkTkn5XIgQ5mzREG9PqoDb6Hgv7DETE5IjRjvHf HGBw== 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=zJzmi/MlCPTZ2lBsRFWW+jUi+O0UeM2VFA4ATD6XWhc=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=YRkj8D+Ja6c8wmXFgCR5w22/yAHlCWHikepv3QYA2MTbu72a1EXOg97FpqddpsSWhB c6rtR+Q451lxv/VKUSLdDTeWHWK98BHho8qCMNW5ArbT7ZaYUql8abjsIwerOk3lm3iT pVH8G82uKA7R2cbUqYJqhBtUzHACaGZR/vsJ6HlawaAkLlqAJ/55U/0sB8G3Hx4pk3oH lTmm5LT3J15NWdR6ATkIZZ/xNssm7LSocULZEhkslr/yIR+5ay4V1f1IgdARlOvsnHAx SjkAieOR542Ci2nm9yTvK6zzSNgo5Od5QhahrFY0ku6Xy9c2KOPZ00DQrYUSajigICJh J6tg== 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 bk19-20020a170906b0d300b0099d5e9aedd7si16710808ejb.482.2023.09.30.15.30.56; Sat, 30 Sep 2023 15:30:56 -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 D0C1E68CD3F; Sun, 1 Oct 2023 01:30:53 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D04C868CD25 for ; Sun, 1 Oct 2023 01:30:47 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 2E69620003 for ; Sat, 30 Sep 2023 22:30:46 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 1 Oct 2023 00:30:32 +0200 Message-Id: <20230930223046.22896-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-Spam-Flag: yes X-Spam-Level: ************** X-GND-Spam-Score: 215 X-GND-Status: SPAM X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 01/15] avformat/concatdec: Check in/outpoint for overflow 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: hp1BK0SnvtqO Fixes: signed integer overflow: 91542414454000000 - -9154241494546000000 cannot be represented in type 'long' Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-4739147999084544 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/concatdec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 5d4f67d0acd..114b6c6564c 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -667,7 +667,9 @@ static int concat_read_header(AVFormatContext *avf) else time = cat->files[i].start_time; if (cat->files[i].user_duration == AV_NOPTS_VALUE) { - if (cat->files[i].inpoint == AV_NOPTS_VALUE || cat->files[i].outpoint == AV_NOPTS_VALUE) + if (cat->files[i].inpoint == AV_NOPTS_VALUE || cat->files[i].outpoint == AV_NOPTS_VALUE || + cat->files[i].outpoint - (uint64_t)cat->files[i].inpoint != av_sat_sub64(cat->files[i].outpoint, cat->files[i].inpoint) + ) break; cat->files[i].user_duration = cat->files[i].outpoint - cat->files[i].inpoint; }