diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-09-12 13:13:42 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-09-18 00:18:11 +0200 |
commit | 175a95bfddc5a6fb69d329e24fd7157a2e1f2099 (patch) | |
tree | 73518f6df62934ec6ef850e386580678b65ba8b3 | |
parent | ac60619acdb5a8b5213d855751f4504a7dd309be (diff) | |
download | ffmpeg-175a95bfddc5a6fb69d329e24fd7157a2e1f2099.tar.gz |
avcodec/avpacket: clear side_data_elems
Fixes null pointer dereference
Found-by: 连一汉 <lianyihan@360.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 5e1bf9d8c0d2cdbbf17b06a5dfdf87a635b3203b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/avpacket.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 35adb86c3d..bf168bed49 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -195,6 +195,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) @@ -209,9 +210,11 @@ FF_DISABLE_DEPRECATION_WARNINGS pkt->destruct = dummy_destruct_packet; FF_ENABLE_DEPRECATION_WARNINGS #endif - 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; |