diff mbox series

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

Message ID 20201017210625.h7thx47jqtkb5z2d@localhost
State New
Headers show
Series [FFmpeg-devel] avformat/format: ensure av_probe_input_buffer2() gives correct format | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate warning Make fate failed

Commit Message

zsugabubus Oct. 17, 2020, 9:06 p.m. UTC
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@national.shitposting.agency>
---
 libavformat/format.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

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) {