From: Carl Eugen Hoyos Date: Sun, 4 Sep 2016 19:11:02 +0000 (+0200) Subject: lavc/avpacket: Fix undefined behaviour, do not pass a null pointer to memcpy(). X-Git-Tag: archive/raspbian/6%11.12-1_deb8u8+rpi1^2~6 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ed456f03e985d12f0cc3d05fedf3c8dafcc5a5a3;p=libav.git lavc/avpacket: Fix undefined behaviour, do not pass a null pointer to memcpy(). Fixes ticket #5128. Gbp-Pq: Name CVE-2018-5766.patch --- diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index cad8047..10ee1a4 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -364,7 +364,8 @@ int av_packet_ref(AVPacket *dst, 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 {