From patchwork Tue Apr 27 19:21:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 27440 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6109:0:0:0:0:0 with SMTP id v9csp1238814iob; Tue, 27 Apr 2021 12:23:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycPhntJpqxbfP4q1dWL1XX57UWS3ln8W2NZN1If+qmypAmInSOt3oITHYM8xA8gHz3kBcN X-Received: by 2002:a05:6402:5203:: with SMTP id s3mr6317489edd.360.1619551383817; Tue, 27 Apr 2021 12:23:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619551383; cv=none; d=google.com; s=arc-20160816; b=e6VmKboh6n30IucwuivvsMhadV+V3IL1z2KnzUMa2uDNSnCsu2spvNW9/m+vZakPW1 P1b6CTayM4rcoNn4M+trfLBY5I9O7bN6tGEr76+rvnD/MZcTxYGwYNzwCcspPXsSPSum CS9AwKjLiRyzpYdxJ/ZY/ZRUUHrQa2tyJRJ50PlWNaLWV73/2wo6aRm8n0tubMRkCohz BhlWm+4POp38pHz7YwA6K94qPHi0m6nyEn0qMKemQIyYVba2ivFJmF9GtE8sOfdKOs6x 1kM+m1CfxIBMWcSC6rqMoNSUWSiwU4e8tw+ktP4tqBbInioPMLrfnbLnsHc9C+0dvkDq LXbA== 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=t+NOmTPeFzgSwx2QdDGcm8qyledHIq66gti08dSb2eA=; b=TdYC6GpT9tUnWpKQSgtI1CK0pS3SwW/u/4yU8Ebnw+g5xtsfzS+2Swoqf5mgpwtoj0 rY1suoGoUot9Sy51KYEq0IHFL/e0+NTGq0cx3uwOVXihT6GtnYjjvun25DkAhwHANEMw erO9CWeSDFJD4786/ts6nBJd8fUMxGkU8lMRica0XmhQRmrX6by+/utoFxhngT05m/2c r8POR/cQWFsIUc2dAF7HWYIbHxFp7Elrr8JEQrnjDZUPIPHeYeuRGyxgCCBv4lyUKlC0 wIS8mg9rZWG5nFphojirDdfCEZ+TR9PgE4+9qTFXgrlOK5gvTrmLsOJlxuvQReEp0Pbg niHg== 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 t24si3363531edw.515.2021.04.27.12.23.00; Tue, 27 Apr 2021 12:23:03 -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 D4F94689F1C; Tue, 27 Apr 2021 22:22:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-1.mx.upcmail.net (vie01a-dmta-pe03-1.mx.upcmail.net [62.179.121.160]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2F41E689AB4 for ; Tue, 27 Apr 2021 22:22:36 +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 1lbTI4-00FPWs-0G for ffmpeg-devel@ffmpeg.org; Tue, 27 Apr 2021 21:22:36 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id bTH6lEuQeljeHbTH6lFofr; Tue, 27 Apr 2021 21:21:36 +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=0jyFa61AvLJFixEQjbkA:9 a=1fhp2MxaeJtTNGEnv6mo:22 a=Z5ABNNGmrOfJ6cZ5bIyy:22 a=UDnyf2zBuKT2w-IlGP_r:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 27 Apr 2021 21:21:34 +0200 Message-Id: <20210427192135.17286-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210427192135.17286-1-michael@niedermayer.cc> References: <20210427192135.17286-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfGTdjo5T48xJeOVTt/aK4+mcWMifwLzX2ZOzvKEUO/ITF/2zvhDuslxblLVbzIIPZU0a+fQJM0RGFMvLAq2Lv9XrMKF4+NG86T82GI4PXHp7Y58oMUvW Kj7eUfkxZXnsaMOlQm0G40Qs1bKb7EkQlX6eovu70xNEJLDyiqBeJ80P Subject: [FFmpeg-devel] [PATCH 3/4] avformat/sbgdec: Check for overflow in timestamp preparation 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: UoGOXH6jh7ML Fixes: signed integer overflow: 9223372036854775807 + 86400000000 cannot be represented in type 'long' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-6731040263634944 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/sbgdec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/sbgdec.c b/libavformat/sbgdec.c index 83016d0c13..9530ea42a5 100644 --- a/libavformat/sbgdec.c +++ b/libavformat/sbgdec.c @@ -1291,6 +1291,10 @@ static int generate_intervals(void *log, struct sbg_script *s, int sample_rate, ev1 = &s->events[i]; ev2 = &s->events[(i + 1) % s->nb_events]; ev1->ts_int = ev1->ts; + + if (!ev1->fade.slide && ev1 >= ev2 && ev2->ts > INT64_MAX - period) + return AVERROR_INVALIDDATA; + ev1->ts_trans = ev1->fade.slide ? ev1->ts : ev2->ts + (ev1 < ev2 ? 0 : period); }