[FFmpeg-cvslog] avformat/format: Stop reading data at EOF during probing
Michael Niedermayer
git at videolan.org
Thu Oct 19 14:31:56 EEST 2023
ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Wed May 10 23:58:31 2023 +0200| [00a7db846c4f77114b7b7e6c5ef951013839c974] | committer: Michael Niedermayer
avformat/format: Stop reading data at EOF during probing
Issue found by: Сергей Колесников
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 80f6e0378beae69d31f24b036a1365405dea61d1)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=00a7db846c4f77114b7b7e6c5ef951013839c974
---
libavformat/format.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libavformat/format.c b/libavformat/format.c
index 1fe4b2d11e..b2434d27a7 100644
--- a/libavformat/format.c
+++ b/libavformat/format.c
@@ -251,6 +251,7 @@ int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt,
int ret = 0, probe_size, buf_offset = 0;
int score = 0;
int ret2;
+ int eof = 0;
if (!max_probe_size)
max_probe_size = PROBE_BUF_MAX;
@@ -277,7 +278,7 @@ int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt,
}
#endif
- for (probe_size = PROBE_BUF_MIN; probe_size <= max_probe_size && !*fmt;
+ for (probe_size = PROBE_BUF_MIN; probe_size <= max_probe_size && !*fmt && !eof;
probe_size = FFMIN(probe_size << 1,
FFMAX(max_probe_size, probe_size + 1))) {
score = probe_size < max_probe_size ? AVPROBE_SCORE_RETRY : 0;
@@ -293,6 +294,7 @@ int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt,
score = 0;
ret = 0; /* error was end of file, nothing read */
+ eof = 1;
}
buf_offset += ret;
if (buf_offset < offset)
More information about the ffmpeg-cvslog
mailing list