allocate 32 extra bytes at the end of the probe buffer and remove most probe buf_size...
[ffmpeg.git] / libavformat / utils.c
index d062948..dec67fa 100644 (file)
@@ -429,7 +429,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
         for(probe_size= PROBE_BUF_MIN; probe_size<=PROBE_BUF_MAX && !fmt; probe_size<<=1){
             int score= probe_size < PROBE_BUF_MAX ? AVPROBE_SCORE_MAX/4 : 0;
             /* read probe data */
-            pd->buf= av_realloc(pd->buf, probe_size);
+            pd->buf= av_realloc(pd->buf, probe_size + AVPROBE_PADDING_SIZE);
             pd->buf_size = get_buffer(pb, pd->buf, probe_size);
             if (url_fseek(pb, 0, SEEK_SET) < 0) {
                 url_fclose(pb);