From patchwork Thu Sep 12 23:33:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 51560 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c541:0:b0:48e:c0f8:d0de with SMTP id f1csp3912vqr; Thu, 12 Sep 2024 16:44:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU0mI9o7t4IlwQdVed9iELLnWSfpydOcoNn7FU9C8IKp2teXbgT03N+unjmu9ArVB7P+fajB4m7OVRSscvx4VRC@gmail.com X-Google-Smtp-Source: AGHT+IGTMPUltB6JwZueI/kY2JrGY5wmRnettsdcYfaY/M1NuFekcqdDUDSEC7c8JJihrGxrlEFe X-Received: by 2002:a17:907:6ea2:b0:a8a:6e20:761e with SMTP id a640c23a62f3a-a9029617457mr440746266b.48.1726184653742; Thu, 12 Sep 2024 16:44:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726184653; cv=none; d=google.com; s=arc-20240605; b=kncTjGFxHnAd+OniMewPXPUS7Ws9TWPgXAemtDAc/FyExHucIqYj3NVYFiP7gooSkN coV1c2N5m4UnhiMLc364XrhI0bTKVZ06n53YqrHKpPjZm8r/PaAnaQsjUVBYaRuu9DBy cybI0TnMpDveakFh93v37mkZVRpRxBFjQQCThBurfcyu3IOUNE+v8NqBqlg2aocKV4ow rddppTqbvwQKu4/NbERf/nOU+hop69Q60AgXYrS2bSSn/9onC5MLwxC9XBJMc1rCuKY+ YzplX14dI2jBbvLPPn0YLDgOQ6zORgT8aA4O/88F6OlIbQHEDEZoiMAPLf6QucBzVesY mp4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=1BzI4e/0dGODyU4GztUdF1WGsTxAhVBCRVYeRB8C4fE=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=KCXq1vNmzM/h8iUskzvsna/C9nnKSB6e25enBfDGbg4HtLBwiytd61ppmvP0WM8a8l R7YTblx9FxT67P+8c6CSX3VJzk6kGVa/mnXK4XR/jIb5KSKVtiu4VJiRMbxKUL/CgTjw /puKbv2nyWKl5uZQsA62/XKol4UJi6EMDYQ938Aq8f6aybOLqmeFUe1HFvr2aDM0SRWr +uUrSCT1T+4IO6lXl0RfpGeI8G52UuJ4fuvmESvCtwHuyXBfJKSEwL9jbRZCnoW0ntSx 62O9mXkTFSstQseHf4oP7fwGKVbHy8+NGTd3Eddx73+1kN9m9cpQJxnlj09rbpJmf1zP INvg==; 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=EvU+oX+M; 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 a640c23a62f3a-a8d25ce9764si925934166b.493.2024.09.12.16.44.13; Thu, 12 Sep 2024 16:44:13 -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; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=EvU+oX+M; 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 7DADD68DCAC; Fri, 13 Sep 2024 02:33:50 +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 2E07168DBF6 for ; Fri, 13 Sep 2024 02:33:42 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 8C8A520003 for ; Thu, 12 Sep 2024 23:33:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1726184021; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8sgSvc8RoanJfItlTM2+reZOvhhGRukZ6IBzOoYcUxo=; b=EvU+oX+MibjTHpnYCRXYQXYlnK+qxiQo7ZkzeeAWAtZEkxdhT59PpLxXjnM/+ONTBjsUh4 2oCE5A+ZkNO/wxrDGCkaKHbJwn9TSqprQsTSeLhjpbcWm/EtfPGhcV4i0cuQ1OoVsOK5/c u3VbYovDpg9RDv+PmbX6rw0S9cryw1h8jYXTmVTBctRzYTqFCdZjzRx2rs1AzFspELIMQK UUXwI5M5R6nLMxKGspsyEEReH/j4xlU2rtu1s7ShWNbT1QbknCkle9FmSQrwu8xdARANDR oAi4LkvcloWldPpgthh2O0RPtqt7sLOLNaCNHq4jA4cerrJ8q+J+tBmQ+huIaQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 13 Sep 2024 01:33:34 +0200 Message-ID: <20240912233337.2444412-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240912233337.2444412-1-michael@niedermayer.cc> References: <20240912233337.2444412-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 4/7] avformat/mxfdec: Check timecode 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: CXlKqzuNN4t+ Fixes: signed integer overflow: 9223372036840103968 + 538976288 cannot be represented in type 'long' Fixes: 70604/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4844090340999168 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/mxfdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index ac63c0d5add..8eae9f87afa 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -2391,6 +2391,9 @@ static int mxf_parse_physical_source_package(MXFContext *mxf, MXFTrack *source_t physical_track->edit_rate, source_track->edit_rate); + if (av_sat_add64(start_position, mxf_tc->start_frame) != start_position + (uint64_t)mxf_tc->start_frame) + continue; + if (av_timecode_init(&tc, mxf_tc->rate, flags, start_position + mxf_tc->start_frame, mxf->fc) == 0) { mxf_add_timecode_metadata(&st->metadata, "timecode", &tc); return 0;