This is an automated email from the git hooks/post-receive script.
Git pushed a commit to branch master
in repository ffmpeg.
The following commit(s) were added to refs/heads/master by this push:
new 597036b692 avformat: Add recursion limit
597036b692 is described below
commit 597036b692b8c39198fe572aad027eeb4c13da35
Author: Michael Niedermayer <[email protected]>
AuthorDate: Mon Jul 7 02:44:19 2025 +0200
Commit: michaelni <[email protected]>
CommitDate: Mon Jul 13 19:35:48 2026 +0000
avformat: Add recursion limit
This is a generic recursion limit that is not specific to a demuxer
it does change public API which makes this unsuitable for backporting
Fixes: self_ref.ffconcat
Reported-by: Yuhao Jiang <[email protected]>
Signed-off-by: Michael Niedermayer <[email protected]>
---
libavformat/avformat.c | 5 +++++
libavformat/avformat.h | 9 +++++++++
libavformat/options_table.h | 1 +
libavformat/version.h | 2 +-
4 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index 0f9d50a99d..db9fad2f2d 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -896,6 +896,11 @@ int ff_copy_whiteblacklists(AVFormatContext *dst, const
AVFormatContext *src)
*(char **)((char*)dst + offsets[i]) = dst_str;
}
}
+ if (src->recursion_limit <= 0) {
+ av_log(dst, AV_LOG_ERROR, "Too deep recursion\n");
+ return AVERROR_INVALIDDATA;
+ }
+ dst->recursion_limit = src->recursion_limit - 1;
return 0;
}
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index ef2b08c4f3..2ebe889b54 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1944,6 +1944,15 @@ typedef struct AVFormatContext {
* Name of this format context, only used for logging purposes.
*/
char *name;
+
+ /**
+ * Depth recursion limit,
+ *
+ * The maximum recursion depth that a Demuxer can open a Demuxer within
itself.
+ *
+ * - demuxing: Set by user
+ */
+ int recursion_limit;
} AVFormatContext;
/**
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index bedec2a8a9..915c553f54 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -107,6 +107,7 @@ static const AVOption avformat_options[] = {
{"skip_estimate_duration_from_pts", "skip duration calculation in
estimate_timings_from_pts", OFFSET(skip_estimate_duration_from_pts),
AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, D},
{"max_probe_packets", "Maximum number of packets to probe a codec",
OFFSET(max_probe_packets), AV_OPT_TYPE_INT, { .i64 = 2500 }, 0, INT_MAX, D },
{"duration_probesize", "Maximum number of bytes to probe the durations of the
streams in estimate_timings_from_pts", OFFSET(duration_probesize),
AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, (double)INT64_MAX, D},
+{"recursion_limit", "Maximum number of times a demuxer can recursively be
opened", OFFSET(recursion_limit), AV_OPT_TYPE_INT, {.i64 = 10 }, 0, INT_MAX, D},
{NULL},
};
diff --git a/libavformat/version.h b/libavformat/version.h
index af7d0a1024..e2634b85ae 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
#include "version_major.h"
-#define LIBAVFORMAT_VERSION_MINOR 4
+#define LIBAVFORMAT_VERSION_MINOR 5
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]