diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2016-09-22 01:03:55 +0200 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2016-09-22 08:39:40 +0200 |
commit | 6fc29572fbf82148e39b18d676688af6d9c17e2f (patch) | |
tree | eca5738b4353812fee7d369705431340ab472300 | |
parent | 677ea4a49b2e7e9ee28fb5e62f9aec73d7acb272 (diff) | |
download | ffmpeg-6fc29572fbf82148e39b18d676688af6d9c17e2f.tar.gz |
lavc/avpacket: Fix undefined behaviour, do not pass a null pointer to memcpy().
Fixes ticket #5857.
(cherry picked from commit c54eef46f990722ed65fd1ad1da3d0fc50806eb5)
-rw-r--r-- | libavcodec/avpacket.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 9218689239..d70ee5d684 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -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; |