diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2016-09-04 21:11:02 +0200 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2016-09-05 10:16:03 +0200 |
commit | f077ad69c682c13ab75a72aec11a61cac53f0c91 (patch) | |
tree | 61b4506f6bf30fe345ed8ba6dcda4ef92f289738 /libavcodec/avpacket.c | |
parent | e7bc9623e577e41d0dfd8ec2e1d1ec0d36333754 (diff) | |
download | ffmpeg-f077ad69c682c13ab75a72aec11a61cac53f0c91.tar.gz |
lavc/avpacket: Fix undefined behaviour, do not pass a null pointer to memcpy().
Fixes ticket #5128.
Diffstat (limited to 'libavcodec/avpacket.c')
-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..fa2844d2cf 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -581,7 +581,8 @@ int av_packet_ref(AVPacket *dst, const AVPacket *src) ret = packet_alloc(&dst->buf, src->size); if (ret < 0) goto fail; - memcpy(dst->buf->data, src->data, src->size); + if (src->size) + memcpy(dst->buf->data, src->data, src->size); dst->data = dst->buf->data; } else { |