]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/utils.c
cafdec: fix overflow checking in read_header()
[ffmpeg] / libavformat / utils.c
index d43e1c0adcaf25ca943d51cbf0b2d76f3f5c11e3..97d65583eedbbd01bed989d74aa4678baebda435 100644 (file)
@@ -442,6 +442,8 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
     } else if (max_probe_size > PROBE_BUF_MAX) {
         max_probe_size = PROBE_BUF_MAX;
     } else if (max_probe_size < PROBE_BUF_MIN) {
+        av_log(logctx, AV_LOG_ERROR,
+               "Specified probe size value %u cannot be < %u\n", max_probe_size, PROBE_BUF_MIN);
         return AVERROR(EINVAL);
     }
 
@@ -2583,11 +2585,26 @@ enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags)
 }
 
 unsigned int av_codec_get_tag(const AVCodecTag * const *tags, enum AVCodecID id)
+{
+    unsigned int tag;
+    if (!av_codec_get_tag2(tags, id, &tag))
+        return 0;
+    return tag;
+}
+
+int av_codec_get_tag2(const AVCodecTag * const *tags, enum AVCodecID id,
+                      unsigned int *tag)
 {
     int i;
     for(i=0; tags && tags[i]; i++){
-        int tag= ff_codec_get_tag(tags[i], id);
-        if(tag) return tag;
+        const AVCodecTag *codec_tags = tags[i];
+        while (codec_tags->id != AV_CODEC_ID_NONE) {
+            if (codec_tags->id == id) {
+                *tag = codec_tags->tag;
+                return 1;
+            }
+            codec_tags++;
+        }
     }
     return 0;
 }