Commit 05a4bacb authored by Vittorio Giovara's avatar Vittorio Giovara

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: 's avatarVittorio Giovara <vittorio.giovara@gmail.com>
parent bcc07e25
...@@ -265,7 +265,7 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, ...@@ -265,7 +265,7 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
int ret; int ret;
uint8_t *data; 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; return NULL;
data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE); data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!data) if (!data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment