From patchwork Mon Mar 25 03:29:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 47419 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c889:b0:1a3:b6bb:3029 with SMTP id hb9csp955689pzb; Sun, 24 Mar 2024 20:29:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWSwBj8UGcJ6Mt/Pm1v/MTanOBxZbwcTS6oOhZXlyxEQAiLyQ9ux9B7nMGRfHdvpG/TP1LGQ5RHDs36okOU3vQxE6rrFtp5lZCSjA== X-Google-Smtp-Source: AGHT+IFgjPbe/oswSic1tfDiUAr7RQCstscGNadNhzFKUuV5QEoKUdAMccSq+9uIqUunuVndJBZb X-Received: by 2002:a50:99d8:0:b0:56b:a8ea:964a with SMTP id n24-20020a5099d8000000b0056ba8ea964amr3839889edb.9.1711337360622; Sun, 24 Mar 2024 20:29:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711337360; cv=none; d=google.com; s=arc-20160816; b=USTwinuVfu/LHbs+GiutZoOmuc14OUxSUY4QQ/wASRT0iRhzck8mHneGG1yAHxuSZU Hg/nxEqJrT4EFATGgaztAnchjxM6IWlZFcWx+MZ3X8lsNwc8zyEWl7wBKv0ZITngM0c8 QvMXz0Qqtbem90fRs6RjeW1hFqgGWNsGXkRTxK28yg74MXE9xb4rSxwuj3fyvZA27EuO nuODONP+QGQ9zlhqIKwW88QOY4s1dFqMi9z4CIOsXjC8e5F3T5ald+Qw9zKeSVWrwL8M QAbAD5x7CoMa7Nk2O93yVCWgKGA1L86JdqSRjV3JO/kqcMQkTdYLID6Erul3wSzuuAhO hf/w== 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:dkim-signature :delivered-to; bh=kY3S9/gPwWmresH2wZwFMTZqXR74/eBQZvcelTeaWZY=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=w3+89fDhTtTAldHzqM7D5/VRa+nXJWQAnaayHqnlapUPFkbnSbq79kfyxYDGh9fzND YLcgryEmpJljkH6vmB0dQVkRtuNT9xwJoDKpx1Jacudsi+LD4g6PcdHFhIUMwsziRwBZ d9Xs1oqFRuVtEj87kcaoQXkj41kjLEsbdkJrAMjIS1o3U+pOpa5FDGAtbpHjgSajflfs mtI4ybG/qkUcIfuSn0pC8ZGr4tQZsJADQf8aY/no0Hb2GseV0HAqXGcv4ofHvdaKnbRN DeqXFt/RDIFDbvoMDs3UpG7bGhzlVJlNXP5bLThepQtT1AUvL7qQgxTmwtfJv3KqiEnd yc8g==; 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=C8PSozQn; 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 h8-20020a05640250c800b0056b95e90890si2118647edb.65.2024.03.24.20.29.20; Sun, 24 Mar 2024 20:29:20 -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=C8PSozQn; 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 5232268D43D; Mon, 25 Mar 2024 05:29:16 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AA8C268D33C for ; Mon, 25 Mar 2024 05:29:09 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id D108E60002 for ; Mon, 25 Mar 2024 03:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1711337349; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc; bh=zPgQ/Fbj24K8DSTUvFkOVa9jLGfKD0VvtZRyewl5eFc=; b=C8PSozQnBbq7QI5HSOTdlyVxNpcWoEP3oNnr1HF1DY8r/gsH/Nd6nAi1ERMnTXDWHuuSR9 F2f23FlaRNuWAGcPgHRyaWi6bQMepD87z/l1azNcC6Ez6+T/xqURtfzHZANCRynDFVDoSw 3V3MJD3TJC+TM7bDG0XCVyOpdOqNXAfC8+yj8DgDL9Nsi7+3i6e1MkTR2fKWdHhcxg1yf5 leZrU3DrmIvLf1Ys0HU+lTZa2517cz7YhSrYiOoNx2gzAjDifahL74HwFKPaCNR5EY/Fq6 zuZu0CSJFtHg/moclXqiYtn3Wy0Dr7x4cNB3yyvmPYkv/1RgxgQPbVzK8ln/Zw== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 25 Mar 2024 04:29:07 +0100 Message-Id: <20240325032908.11939-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 1/2] avformat/mov: Check edit list 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: 4apuf3NTaoi9 Fixes: 67492/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5778297231310848 Fixes: signed integer overflow: 2314885530818453536 + 7782220156096217088 cannot be represented in type 'long' Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/mov.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index a87ce5cefe..5dbe61a005 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3683,6 +3683,10 @@ static int get_edit_list_entry(MOVContext *mov, } *edit_list_duration = av_rescale(*edit_list_duration, msc->time_scale, global_timescale); + + if (*edit_list_duration + (uint64_t)*edit_list_media_time > INT64_MAX) + *edit_list_duration = 0; + return 1; }