diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 8f0603df78..2b20067211 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) {