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_deb8u9+rpi1^2~11 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=04e15d0896d50623be7a15f559227ab56aa15b4b;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 {