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>
... | ... |
@@ -370,9 +370,6 @@ int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, |
370 | 370 |
for(probe_size= PROBE_BUF_MIN; probe_size<=max_probe_size && !*fmt; |
371 | 371 |
probe_size = FFMIN(probe_size<<1, FFMAX(max_probe_size, probe_size+1))) { |
372 | 372 |
|
373 |
- if (probe_size < offset) { |
|
374 |
- continue; |
|
375 |
- } |
|
376 | 373 |
score = probe_size < max_probe_size ? AVPROBE_SCORE_RETRY : 0; |
377 | 374 |
|
378 | 375 |
/* read probe data */ |
... | ... |
@@ -388,6 +385,8 @@ int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, |
388 | 388 |
ret = 0; /* error was end of file, nothing read */ |
389 | 389 |
} |
390 | 390 |
buf_offset += ret; |
391 |
+ if (buf_offset < offset) |
|
392 |
+ continue; |
|
391 | 393 |
pd.buf_size = buf_offset - offset; |
392 | 394 |
pd.buf = &buf[offset]; |
393 | 395 |
|