From c7f625eecff0fb76f077d516c15a586576466e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5ns=20Rullg=C3=A5rd?= Date: Tue, 16 Mar 2010 21:45:30 +0000 Subject: [PATCH] Fix erroneous behaviour when format probe hits end of file If the format probe hits end of file, do not add the error code to the buffer position. This is obviously wrong, and with a small input file would cause a negative buffer overflow. Fixes issue 1818. Originally committed as revision 22571 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index fa7e8dea77..d9478dbbd0 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -495,6 +495,7 @@ int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt, return ret; } score = 0; + ret = 0; /* error was end of file, nothing read */ } pd.buf_size += ret; pd.buf = &buf[offset];