[FFmpeg-devel] [PATCH 2/6] lavc/avpacket: check NULL before using the pointer

Jun Zhao mypopydev at gmail.com
Fri May 10 19:05:50 EEST 2019


From: Jun Zhao <barryjzhao at tencent.com>

Need to check NULL before using the pointer

Signed-off-by: Jun Zhao <barryjzhao at tencent.com>
---
 libavcodec/avpacket.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 8f0603d..2b20067 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -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) {
-- 
1.7.1



More information about the ffmpeg-devel mailing list