From patchwork Wed Dec 28 03:19:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 39800 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp3859547pzb; Tue, 27 Dec 2022 19:20:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXu6oWc8DKSmPSHuWyhHS8+96XHj5PiHqqAnpsLjAeD+/5OYgFL1PjU0wZB6VlqgXRGOFqcO X-Received: by 2002:a17:907:d50e:b0:81f:fc05:2ba0 with SMTP id wb14-20020a170907d50e00b0081ffc052ba0mr21012199ejc.2.1672197634306; Tue, 27 Dec 2022 19:20:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672197634; cv=none; d=google.com; s=arc-20160816; b=WTfn8naFOfzTQL0pvvRZngj+4dmsnZ8rvcnnXiaPq6FRM44hWIaJABDO6eLhe+ezDy eUUQ8w3Fu1Cc7CsZqj/IXV0Jh0p72BeBgCfjD3tkRCs+2eWPvnMBwHrp/+wdb8+12gC5 1w7ZyvmZVxouiMBX869zKMLkkWKWY09qeSM97jDQgFzXQT+Os1QHdEMKgFSFvAQHau5m P5GxR3iiHjgVgL989tI/DkQgV63OYUD6v5NLcUglA9toylLFFGKHzoyTYbm4jssSvSkr 1nKac0ZjqKDkUzEFNTDYfmZJw88iJj2NRVqYmuyuMvMHYZryzVRvWlmN5z4YwFf20zHc xSHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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:delivered-to; bh=2PJuxw8N7hLjw5zpFFxTKccyg8x5uy6yKSx2C3ipvFE=; b=sb1pMXjNU24QT0k/jAj3wSo41VmQHOIK2CJxg/WJH0/TEzAamSLnLa+tky/M8etd8f c04CIT3FWkIJK/I6+8IaQxvUYDmp4Skw8N9+sSh4+P31+tkueDLCY1UDVCnWtFz41saR GnSB0hfyjpdrtz1KxK+zNt8pPlUEwWP9p+CBAtYjtOdJYgHekJ05tR/uNq3R5C4ZrxIn UI8LgO0PY6Y8eRlrmZZzBzRJJI3A7L0Ak3p62mZBFP8AddNu2/Gp6n9ulYRlaEGuQbut gUP+wyjbPtm5Q+p91oqpynve6Y2t5yIzn1G9jba8oEkW2d147Fpm7RFpt4uZCzDCDsFs ZAkA== 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 xc6-20020a170907074600b00780e89aecd1si11834592ejb.849.2022.12.27.19.20.32; Tue, 27 Dec 2022 19:20:34 -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; 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 639E268BC6E; Wed, 28 Dec 2022 05:20:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E460268BC3B for ; Wed, 28 Dec 2022 05:20:08 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 6E1E4E82F8; Wed, 28 Dec 2022 04:20:07 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uuej1nIHVPD8; Wed, 28 Dec 2022 04:20:05 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 84836E8411; Wed, 28 Dec 2022 04:20:05 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Dec 2022 04:19:58 +0100 Message-Id: <20221228031958.26570-3-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221228031958.26570-1-cus@passwd.hu> References: <76674b9a-30ff-a43-6d51-8c74dca8fa@passwd.hu> <20221228031958.26570-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] avformat/mxfdec: check number of index table entires more strictly 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 Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: BHSGpyFg6aGQ Let's ignore the index table if the number of index entries does not match the index duration (or the special AVID index entry counts). Fixes: OOM Fixes: 50551/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-6607795234930688 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Marton Balint --- libavformat/mxfdec.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 2e61e77d67..0dc61648b1 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1937,6 +1937,14 @@ static int mxf_compute_ptses_fake_index(MXFContext *mxf, MXFIndexTable *index_ta return 0; } + if (s->nb_index_entries != s->index_duration && + s->nb_index_entries != s->index_duration + 1 && + s->nb_index_entries != s->index_duration * 2 + 1) { + index_table->nb_ptses = 0; + av_log(mxf->fc, AV_LOG_ERROR, "ignoring IndexSID %d, duration does not match nb_index_entries\n", s->index_sid); + return 0; + } + index_table->nb_ptses += s->index_duration; }