Commit f077ad69 authored by Carl Eugen Hoyos's avatar Carl Eugen Hoyos

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

Fixes ticket #5128.
parent e7bc9623
...@@ -581,7 +581,8 @@ int av_packet_ref(AVPacket *dst, const AVPacket *src) ...@@ -581,7 +581,8 @@ int av_packet_ref(AVPacket *dst, const AVPacket *src)
ret = packet_alloc(&dst->buf, src->size); ret = packet_alloc(&dst->buf, src->size);
if (ret < 0) if (ret < 0)
goto fail; 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; dst->data = dst->buf->data;
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment