aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-20 16:47:00 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-11-20 17:35:48 +0100
commitfcb1b0078d3810aa2d9270e1095c8b5835fc5667 (patch)
treec9cddb92f48867b4ece5d67bad4ea3c750f83bc4
parentc28b61caf0e3f20714d428d9bce5bd41ebf4cfde (diff)
downloadffmpeg-fcb1b0078d3810aa2d9270e1095c8b5835fc5667.tar.gz
avcodec/avpacket: use size_t, fix potential integer overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/avpacket.c6
1 files 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;