Browse Source

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>
tags/n3.2
Vittorio Giovara 9 years ago
parent
commit
05a4bacbf7
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      libavcodec/avpacket.c

+ 1
- 1
libavcodec/avpacket.c View File

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


Loading…
Cancel
Save