From patchwork Mon Apr 15 19:34:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 48081 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:670b:b0:1a9:af23:56c1 with SMTP id wh11csp2057413pzb; Mon, 15 Apr 2024 12:34:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVD7OoqQbzxGUy/qvFkMVa3K9HCbNH4h3RUvLvtqbaXh7PAkkbyMgwPQYAwu5IRECSxUv22RyZ3yjVmGsL3HrJq2gqN9qpuu/ejEA== X-Google-Smtp-Source: AGHT+IHATd+Md2b7QiyvwUySxk8rOTdbuZuJFmhOv3CQhMF8SZqN5+h19XE3CUEL+yGzLpM2+Mi9 X-Received: by 2002:a17:906:eec9:b0:a55:144a:adc2 with SMTP id wu9-20020a170906eec900b00a55144aadc2mr1508778ejb.6.1713209656236; Mon, 15 Apr 2024 12:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713209656; cv=none; d=google.com; s=arc-20160816; b=EI61VnjGd3MpPzq53p8nmV5xEY/UWUBtlbaCU27ij1YmQW/J7C1t96sxjHshgaSgYD C/yqqpNbdC4JkJaRh4xxjADVuK8AJ/qKfNqJGyutszfqkjkXY5CeQwa5ZieADbBj2rMx ZBi3LgoyB1+jdsjinyKZcBLhxo3W3+VL8xgGiec3uPMEh7QXjdQZHw17BbP5zqVb1nFt TPSbWJgv4LTZIPe3s+hdjn5KwA1HPH6tw4jmrC+KwOMmeT1eHdx7cKsCT2I+W0h3AdzO sz0hrGKInQPn+sPsNTB4YafbCTYaqHAq2bRt83xPlHl/AQsNVGM4ac1ctJikcImMSMx3 JyGg== 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:message-id:date:to:from :delivered-to; bh=8kn6ji+rl4WRJLGlaYPVQLOgKsLLYrxW951JeLCECvg=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=JfeuwlJ9i8T1NKq8jViyo/mR4jKH0HNfVrjixEu/+K9V8dYFHWvBRmS48JUqbonxl9 SXHwndhxpwEiSShqlTdRdFiIgfr4qZZPV0LwBjRg7XnedfUe+H/3ZZcm4gSFnRG57I2o dG/nDjfeYzyiJA+t4P+FyOOhXVHiBQD9N69zfqCcFenID+3f3JNSiphzyn9DHdFBFR/u oOS8fqGWRp97cjRTglQMJ4LnSAtRcLQc5dkRis/VNKJhAQ/BxZAZdsH3ZIoWPHIMM73s oR5PG/YJnJdhD2Mx0wJ8rYspWMoS1l7ep2NiWrPBzPh8QGAvgBaX5VBV3eFlUoGtm6A6 nJgQ==; dara=google.com 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 o16-20020a1709062e9000b00a5271db4b7dsi933971eji.428.2024.04.15.12.34.15; Mon, 15 Apr 2024 12:34:16 -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 960D368CEEE; Mon, 15 Apr 2024 22:34:11 +0300 (EEST) 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 E808F68C53C for ; Mon, 15 Apr 2024 22:34:04 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id A4E85EA3F4; Mon, 15 Apr 2024 21:34:03 +0200 (CEST) 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 pumF9tNbADpD; Mon, 15 Apr 2024 21:34:01 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 9B36CEA1B7; Mon, 15 Apr 2024 21:34:01 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Apr 2024 21:34:00 +0200 Message-Id: <20240415193400.32630-1-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/mxfdec: only check index_edit_rate when calculating the index tables 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: Vpxe4miP4QNM Commit ed49391961999f028e0bc55767d0eef6eeb15e49 started rejecting negative index segment edit rates to avoid negative av_rescale parameters. There are two problems with this: 1) there is already a validation for zero (uninitialized) rates later on 2) it rejects files with 0/0 index edit rates which do exist and we should continue to support those Let's solve these problems by removing the new check and extending the old check for negative index edit rates. This should fix the original issue and also restore support for 0/0 index edit rates. Signed-off-by: Marton Balint --- libavformat/mxfdec.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 233d614f78..71692c36bd 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1264,9 +1264,6 @@ static int mxf_read_index_table_segment(void *arg, AVIOContext *pb, int tag, int case 0x3F0B: segment->index_edit_rate.num = avio_rb32(pb); segment->index_edit_rate.den = avio_rb32(pb); - if (segment->index_edit_rate.num <= 0 || - segment->index_edit_rate.den <= 0) - return AVERROR_INVALIDDATA; av_log(NULL, AV_LOG_TRACE, "IndexEditRate %d/%d\n", segment->index_edit_rate.num, segment->index_edit_rate.den); break; @@ -2135,7 +2132,7 @@ static int mxf_compute_index_tables(MXFContext *mxf) /* fix zero IndexDurations */ for (k = 0; k < t->nb_segments; k++) { - if (!t->segments[k]->index_edit_rate.num || !t->segments[k]->index_edit_rate.den) { + if (t->segments[k]->index_edit_rate.num <= 0 || t->segments[k]->index_edit_rate.den <= 0) { av_log(mxf->fc, AV_LOG_WARNING, "IndexSID %i segment %i has invalid IndexEditRate\n", t->index_sid, k); if (mxf_track)