avcodec/avpacket: Check metadata key in av_packet_unpack_dictionary()
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 27 Feb 2017 03:12:09 +0000 (04:12 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 1 Mar 2017 13:07:33 +0000 (14:07 +0100)
Fixes timeout
Fixes: 501/clusterfuzz-testcase-5672752870588416

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/avpacket.c

index 8e028a2..60269aa 100644 (file)
@@ -508,7 +508,7 @@ int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **di
         const uint8_t *key = data;
         const uint8_t *val = data + strlen(key) + 1;
 
-        if (val >= end)
+        if (val >= end || !*key)
             return AVERROR_INVALIDDATA;
 
         ret = av_dict_set(dict, key, val, 0);