[FFmpeg-devel] [PATCH] avformat/format: ensure av_probe_input_buffer2() gives correct format

zsugabubus zsugabubus at national.shitposting.agency
Sun Oct 18 00:06:25 EEST 2020


av_probe_input_buffer2() iterates until *fmt is found. If *fmt is not
zeroed out beforehand, no probes will be taken because it is detected
that format is already found at the beginning. In these cases method
returns success with *fmt potentially containing the previous junk.

Signed-off-by: zsugabubus <zsugabubus at national.shitposting.agency>
---
 libavformat/format.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/format.c b/libavformat/format.c
index c47490c..7a5e846 100644
--- a/libavformat/format.c
+++ b/libavformat/format.c
@@ -229,6 +229,8 @@ int av_probe_input_buffer2(AVIOContext *pb, ff_const59 AVInputFormat **fmt,
     int score = 0;
     int ret2;
 
+    *fmt = NULL;
+
     if (!max_probe_size)
         max_probe_size = PROBE_BUF_MAX;
     else if (max_probe_size < PROBE_BUF_MIN) {
-- 
2.28.0




More information about the ffmpeg-devel mailing list