[FFmpeg-cvslog] r22688 - trunk/libavformat/utils.c

stefano subversion
Fri Mar 26 02:12:14 CET 2010


Author: stefano
Date: Fri Mar 26 02:12:14 2010
New Revision: 22688

Log:
Fix updating condition for the probe_size variable in the internal
loop of ff_probe_input_buffer(), making sure that probe_size is always
set to probe_max_size in the last iteration.

Also make the function return an error if we get to the max probe
length and still cannot figure out what the format is.

Patch by Micah Galizia micahgalizia A gmail D com.

Modified:
   trunk/libavformat/utils.c

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	Fri Mar 26 01:38:53 2010	(r22687)
+++ trunk/libavformat/utils.c	Fri Mar 26 02:12:14 2010	(r22688)
@@ -478,7 +478,8 @@ int ff_probe_input_buffer(ByteIOContext 
         return AVERROR(EINVAL);
     }
 
-    for(probe_size= PROBE_BUF_MIN; probe_size<=max_probe_size && !*fmt && ret >= 0; probe_size<<=1){
+    for(probe_size= PROBE_BUF_MIN; probe_size<=max_probe_size && !*fmt && ret >= 0;
+        probe_size = FFMIN(probe_size<<1, FFMAX(max_probe_size, probe_size+1))) {
         int ret, score = probe_size < max_probe_size ? AVPROBE_SCORE_MAX/4 : 0;
         int buf_offset = (probe_size == PROBE_BUF_MIN) ? 0 : probe_size>>1;
 
@@ -513,6 +514,11 @@ int ff_probe_input_buffer(ByteIOContext 
     }
 
     av_free(buf);
+
+    if (!*fmt) {
+        return AVERROR_INVALIDDATA;
+    }
+
     if (url_fseek(*pb, 0, SEEK_SET) < 0) {
         url_fclose(*pb);
         if (url_fopen(pb, filename, URL_RDONLY) < 0)



More information about the ffmpeg-cvslog mailing list