[FFmpeg-devel] [PATCH] avcodec/avpacket: Check metadata key in av_packet_unpack_dictionary()

Michael Niedermayer michael at niedermayer.cc
Mon Feb 27 05:12:09 EET 2017


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 at niedermayer.cc>
---
 libavcodec/avpacket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 8e028a2a6c..60269aa63d 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -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);
-- 
2.11.0



More information about the ffmpeg-devel mailing list