1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-08-15 22:05:07 +02:00

avpacket: Error out when creating 0-sized side data

This mimics the behaviour of other av_*_new_side_data().
This is not caught by the malloc check, since padding
is always added to the allocated size.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
This commit is contained in:
Vittorio Giovara 2016-06-09 18:35:03 -04:00
parent bcc07e2576
commit 05a4bacbf7

View File

@ -265,7 +265,7 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
int ret;
uint8_t *data;
if ((unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
if (!size || (unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
return NULL;
data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!data)