diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2016-06-09 18:35:03 -0400 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2016-06-13 13:31:21 -0400 |
commit | 05a4bacbf7ece618553d339afe1d0b57bc87aea8 (patch) | |
tree | 56fc0b561c3cedfe4e4655a13a56eee2e9b2d6d0 | |
parent | bcc07e2576cb723007bea1238afd019ae2d1b005 (diff) | |
download | ffmpeg-05a4bacbf7ece618553d339afe1d0b57bc87aea8.tar.gz |
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>
-rw-r--r-- | libavcodec/avpacket.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 04d6244163..76fc4eb78f 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -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) |