From fcb1b0078d3810aa2d9270e1095c8b5835fc5667 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 20 Nov 2013 16:47:00 +0100 Subject: [PATCH] avcodec/avpacket: use size_t, fix potential integer overflow Signed-off-by: Michael Niedermayer --- libavcodec/avpacket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index e30845c0c0..88ec0be4a3 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -437,12 +437,12 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size) return NULL; while ((t = av_dict_get(dict, "", t, AV_DICT_IGNORE_SUFFIX))) { - const int keylen = strlen(t->key); - const int valuelen = strlen(t->value); + const size_t keylen = strlen(t->key); + const size_t valuelen = strlen(t->value); const size_t new_size = *size + keylen + 1 + valuelen + 1; uint8_t *const new_data = av_realloc(data, new_size); - if (!new_data) + if (!new_data || new_size > INT_MAX) goto fail; data = new_data;