Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avformat/mxfdec: only check index_edit_rate when calculating the index tables
@ 2024-04-15 19:34 Marton Balint
  2024-04-29 20:46 ` Tomas Härdin
  0 siblings, 1 reply; 7+ messages in thread
From: Marton Balint @ 2024-04-15 19:34 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Marton Balint

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 <cus@passwd.hu>
---
 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)
-- 
2.35.3

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-05-06 11:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-15 19:34 [FFmpeg-devel] [PATCH] avformat/mxfdec: only check index_edit_rate when calculating the index tables Marton Balint
2024-04-29 20:46 ` Tomas Härdin
2024-05-02 21:01   ` Marton Balint
2024-05-02 23:37     ` Michael Niedermayer
2024-05-03 14:50     ` Tomas Härdin
2024-05-04  1:49       ` Marton Balint
2024-05-06 11:23         ` Tomas Härdin

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git