mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
avcodec/avpacket: fix order of operations in case of too large allocation
Found-by: wm4 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
34b7c82dd3
commit
e50278348a
@ -442,9 +442,11 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)
|
||||
const size_t new_size = *size + keylen + 1 + valuelen + 1;
|
||||
uint8_t *const new_data = av_realloc(data, new_size);
|
||||
|
||||
if (!new_data || new_size > INT_MAX)
|
||||
if (!new_data)
|
||||
goto fail;
|
||||
data = new_data;
|
||||
if (new_size > INT_MAX)
|
||||
goto fail;
|
||||
|
||||
memcpy(data + *size, t->key, keylen + 1);
|
||||
memcpy(data + *size + keylen + 1, t->value, valuelen + 1);
|
||||
|
Loading…
Reference in New Issue
Block a user