summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-01-13 22:17:12 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-01-13 22:23:40 +0100
commit8c3b026a0eeb49464d957b61b0c01cceecc416fd (patch)
tree6203558d9d9a708f86b111b6824fb10555765c4f /libavformat
parent6a2064820b52568c05a9ec8f418f18840e7c43cc (diff)
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>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index b7a569c1c3..e880650c41 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -372,9 +372,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 */
@@ -390,6 +387,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];