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 1/2] avformat/format: Stop reading data at EOF during probing
@ 2023-05-10 21:58 Michael Niedermayer
  2023-05-10 21:58 ` [FFmpeg-devel] [PATCH 2/2] avformat/hls: reduce default max reload to 100 Michael Niedermayer
  2023-09-16 17:35 ` [FFmpeg-devel] [PATCH 1/2] avformat/format: Stop reading data at EOF during probing Michael Niedermayer
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Niedermayer @ 2023-05-10 21:58 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Issue found by: Сергей Колесников
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/format.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/format.c b/libavformat/format.c
index 76f25ab5a6..52b814e67d 100644
--- a/libavformat/format.c
+++ b/libavformat/format.c
@@ -231,6 +231,7 @@ int av_probe_input_buffer2(AVIOContext *pb, const 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;
@@ -254,7 +255,7 @@ int av_probe_input_buffer2(AVIOContext *pb, const AVInputFormat **fmt,
         }
     }
 
-    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;
@@ -270,6 +271,7 @@ int av_probe_input_buffer2(AVIOContext *pb, const AVInputFormat **fmt,
 
             score = 0;
             ret   = 0;          /* error was end of file, nothing read */
+            eof   = 1;
         }
         buf_offset += ret;
         if (buf_offset < offset)
-- 
2.17.1

_______________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2023-09-16 17:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-10 21:58 [FFmpeg-devel] [PATCH 1/2] avformat/format: Stop reading data at EOF during probing Michael Niedermayer
2023-05-10 21:58 ` [FFmpeg-devel] [PATCH 2/2] avformat/hls: reduce default max reload to 100 Michael Niedermayer
2023-05-11 17:36   ` Paul B Mahol
2023-05-11 22:45     ` Michael Niedermayer
2023-09-16 17:35 ` [FFmpeg-devel] [PATCH 1/2] avformat/format: Stop reading data at EOF during probing Michael Niedermayer

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