1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

lavc/avpacket: Fix undefined behaviour, do not pass a null pointer to memcpy().

Fixes ticket #5857.
This commit is contained in:
Carl Eugen Hoyos 2016-09-22 01:03:55 +02:00
parent 7447ec91b5
commit c54eef46f9

View File

@ -139,7 +139,8 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
pkt->buf = av_buffer_alloc(new_size);
if (!pkt->buf)
return AVERROR(ENOMEM);
memcpy(pkt->buf->data, pkt->data, pkt->size);
if (pkt->size > 0)
memcpy(pkt->buf->data, pkt->data, pkt->size);
pkt->data = pkt->buf->data;
}
pkt->size += grow_by;