mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
lavc/avpacket: Fix undefined behaviour, do not pass a null pointer to memcpy().
Fixes ticket #5857.
This commit is contained in:
parent
7447ec91b5
commit
c54eef46f9
@ -139,7 +139,8 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
|
|||||||
pkt->buf = av_buffer_alloc(new_size);
|
pkt->buf = av_buffer_alloc(new_size);
|
||||||
if (!pkt->buf)
|
if (!pkt->buf)
|
||||||
return AVERROR(ENOMEM);
|
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->data = pkt->buf->data;
|
||||||
}
|
}
|
||||||
pkt->size += grow_by;
|
pkt->size += grow_by;
|
||||||
|
Loading…
Reference in New Issue
Block a user