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>
This commit is contained in:
parent
ac60619acd
commit
175a95bfdd
@ -195,6 +195,7 @@ static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup)
|
|||||||
{
|
{
|
||||||
pkt->data = NULL;
|
pkt->data = NULL;
|
||||||
pkt->side_data = NULL;
|
pkt->side_data = NULL;
|
||||||
|
pkt->side_data_elems = 0;
|
||||||
if (pkt->buf) {
|
if (pkt->buf) {
|
||||||
AVBufferRef *ref = av_buffer_ref(src->buf);
|
AVBufferRef *ref = av_buffer_ref(src->buf);
|
||||||
if (!ref)
|
if (!ref)
|
||||||
@ -209,9 +210,11 @@ FF_DISABLE_DEPRECATION_WARNINGS
|
|||||||
pkt->destruct = dummy_destruct_packet;
|
pkt->destruct = dummy_destruct_packet;
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
if (pkt->side_data_elems && dup)
|
if (src->side_data_elems && dup) {
|
||||||
pkt->side_data = src->side_data;
|
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 av_copy_packet_side_data(pkt, src);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user