Browse Source

avcodec/avpacket: use size_t, fix potential integer overflow

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.2-rc1
Michael Niedermayer 12 years ago
parent
commit
fcb1b0078d
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      libavcodec/avpacket.c

+ 3
- 3
libavcodec/avpacket.c View File

@@ -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;



Loading…
Cancel
Save