diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-01-13 22:17:12 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-02-04 05:20:08 +0100 |
commit | 3994eebb1e8765a96197811f33fd98a7add4380a (patch) | |
tree | 14d6e49fdad80c54483adc6e14b08c529a202ae8 | |
parent | 82b44665e98256cd335ac35b4b6f1d46d82126cf (diff) | |
download | ffmpeg-3994eebb1e8765a96197811f33fd98a7add4380a.tar.gz |
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@gmx.at>
(cherry picked from commit 8c3b026a0eeb49464d957b61b0c01cceecc416fd)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/utils.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 3a736d18e0..bd02da6d41 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -461,9 +461,6 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, probe_size = FFMIN(probe_size<<1, FFMAX(max_probe_size, probe_size+1))) { void *buftmp; - if (probe_size < offset) { - continue; - } score = probe_size < max_probe_size ? AVPROBE_SCORE_RETRY : 0; /* read probe data */ @@ -483,6 +480,8 @@ int av_probe_input_buffer(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]; |