[FFmpeg-cvslog] avformat/utils/av_probe_input_buffer2: fix offset check

Michael Niedermayer git at videolan.org
Tue Jan 14 00:44:21 CET 2014


ffmpeg | branch: release/2.1 | Michael Niedermayer <michaelni at gmx.at> | Mon Jan 13 22:17:12 2014 +0100| [0a055cc62e236b2475fee28cae761c3c33b4b8e5] | committer: Michael Niedermayer

avformat/utils/av_probe_input_buffer2: fix offset check

The check could fail if avio_read() read less than requested

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 8c3b026a0eeb49464d957b61b0c01cceecc416fd)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0a055cc62e236b2475fee28cae761c3c33b4b8e5
---

 libavformat/utils.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8854d5f..ef688a5 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -370,9 +370,6 @@ int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt,
     for(probe_size= PROBE_BUF_MIN; probe_size<=max_probe_size && !*fmt;
         probe_size = FFMIN(probe_size<<1, FFMAX(max_probe_size, probe_size+1))) {
 
-        if (probe_size < offset) {
-            continue;
-        }
         score = probe_size < max_probe_size ? AVPROBE_SCORE_RETRY : 0;
 
         /* read probe data */
@@ -388,6 +385,8 @@ int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt,
             ret = 0;            /* error was end of file, nothing read */
         }
         buf_offset += ret;
+        if (buf_offset < offset)
+            continue;
         pd.buf_size = buf_offset - offset;
         pd.buf = &buf[offset];
 



More information about the ffmpeg-cvslog mailing list