[FFmpeg-cvslog] avcodec/avpacket: clear side_data_elems
Michael Niedermayer
git at videolan.org
Wed Sep 28 15:50:12 EEST 2016
ffmpeg | branch: release/3.1 | Michael Niedermayer <michael at niedermayer.cc> | Mon Sep 12 13:13:42 2016 +0200| [c2087fc48b46ac478944b4e6c59ae2a3a05da0e1] | committer: Michael Niedermayer
avcodec/avpacket: clear side_data_elems
Fixes null pointer dereference
Found-by: 连一汉 <lianyihan at 360.cn>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 5e1bf9d8c0d2cdbbf17b06a5dfdf87a635b3203b)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c2087fc48b46ac478944b4e6c59ae2a3a05da0e1
---
libavcodec/avpacket.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index d70ee5d..bb0fc6c 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -199,6 +199,7 @@ static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup)
{
pkt->data = NULL;
pkt->side_data = NULL;
+ pkt->side_data_elems = 0;
if (pkt->buf) {
AVBufferRef *ref = av_buffer_ref(src->buf);
if (!ref)
@@ -208,9 +209,11 @@ static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup)
} else {
DUP_DATA(pkt->data, src->data, pkt->size, 1, ALLOC_BUF);
}
- if (pkt->side_data_elems && dup)
+ if (src->side_data_elems && dup) {
pkt->side_data = src->side_data;
- if (pkt->side_data_elems && !dup) {
+ pkt->side_data_elems = src->side_data_elems;
+ }
+ if (src->side_data_elems && !dup) {
return av_copy_packet_side_data(pkt, src);
}
return 0;
More information about the ffmpeg-cvslog
mailing list