Message ID | 201609220107.06288.cehoyos@ag.or.at |
---|---|
State | Accepted |
Commit | c54eef46f990722ed65fd1ad1da3d0fc50806eb5 |
Headers | show |
On Thu, Sep 22, 2016 at 01:07:06AM +0200, Carl Eugen Hoyos wrote: > Hi! > > Attached patch fixes ticket #5857. > > Please comment, Carl Eugen > avpacket.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > 6ff2850caef558476bbe522b398edd97233e69d9 0001-lavc-avpacket-Fix-undefined-behaviour-do-not-pass-a-.patch > From 20e673f5303fef7b0adc7737d2023bebfe18014f Mon Sep 17 00:00:00 2001 > From: Carl Eugen Hoyos <cehoyos@ag.or.at> > Date: Thu, 22 Sep 2016 01:03:55 +0200 > Subject: [PATCH] lavc/avpacket: Fix undefined behaviour, do not pass a null > pointer to memcpy(). > > Fixes ticket #5857. LGTM please backport this one too thx [...]
2016-09-22 3:39 GMT+02:00 Michael Niedermayer <michael@niedermayer.cc>: > On Thu, Sep 22, 2016 at 01:07:06AM +0200, Carl Eugen Hoyos wrote: >> Hi! >> >> Attached patch fixes ticket #5857. >> >> Please comment, Carl Eugen > >> avpacket.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> 6ff2850caef558476bbe522b398edd97233e69d9 0001-lavc-avpacket-Fix-undefined-behaviour-do-not-pass-a-.patch >> From 20e673f5303fef7b0adc7737d2023bebfe18014f Mon Sep 17 00:00:00 2001 >> From: Carl Eugen Hoyos <cehoyos@ag.or.at> >> Date: Thu, 22 Sep 2016 01:03:55 +0200 >> Subject: [PATCH] lavc/avpacket: Fix undefined behaviour, do not pass a null >> pointer to memcpy(). >> >> Fixes ticket #5857. > > LGTM Patch applied. > please backport this one too Done. Thank you, Carl Eugen
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index a485064..c3f871c 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;
Hi! Attached patch fixes ticket #5857. Please comment, Carl Eugen From 20e673f5303fef7b0adc7737d2023bebfe18014f Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos <cehoyos@ag.or.at> Date: Thu, 22 Sep 2016 01:03:55 +0200 Subject: [PATCH] lavc/avpacket: Fix undefined behaviour, do not pass a null pointer to memcpy(). Fixes ticket #5857. --- libavcodec/avpacket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)