This mimics the behaviour of other av_*_new_side_data(). This is not caught by the malloc check, since AV_INPUT_BUFFER_PADDING_SIZE is always added to the allocated size.
Signed-off-by: Vittorio Giovara <[email protected]> --- This is assuming that packet side data cannot be used empty. [documentation needed] Vittorio libavcodec/avpacket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 04d6244..76fc4eb 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) -- 2.8.3 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
