]> git.sesse.net Git - ffmpeg/commitdiff
lavc/avpacket: check NULL before using the pointer
authorJun Zhao <barryjzhao@tencent.com>
Fri, 10 May 2019 11:03:54 +0000 (19:03 +0800)
committerJun Zhao <barryjzhao@tencent.com>
Sun, 12 May 2019 06:17:22 +0000 (14:17 +0800)
Need to check NULL before using the pointer

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
libavcodec/avpacket.c

index 8f0603df782380930ccff0674ba20102a35fbbc9..2b20067211baf1d7497310e660cb47a09f7b31b2 100644 (file)
@@ -522,11 +522,12 @@ fail:
 
 int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict)
 {
-    const uint8_t *end = data + size;
+    const uint8_t *end;
     int ret = 0;
 
     if (!dict || !data || !size)
         return ret;
+    end = data + size;
     if (size && end[-1])
         return AVERROR_INVALIDDATA;
     while (data < end) {