Commit 9f8854cb authored by Marton Balint's avatar Marton Balint

avcodec/avpacket: add some assertions to ensure pkt->data is not null if pkt->size > 0

This should fix the following Coverity false positives:

Coverity CID #1405450.
Coverity CID #1430930.
Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
parent 57580e2a
......@@ -616,6 +616,7 @@ int av_packet_ref(AVPacket *dst, const AVPacket *src)
ret = packet_alloc(&dst->buf, src->size);
if (ret < 0)
goto fail;
av_assert1(!src->size || src->data);
if (src->size)
memcpy(dst->buf->data, src->data, src->size);
......@@ -668,6 +669,7 @@ int av_packet_make_refcounted(AVPacket *pkt)
ret = packet_alloc(&pkt->buf, pkt->size);
if (ret < 0)
return ret;
av_assert1(!pkt->size || pkt->data);
if (pkt->size)
memcpy(pkt->buf->data, pkt->data, pkt->size);
......@@ -687,6 +689,7 @@ int av_packet_make_writable(AVPacket *pkt)
ret = packet_alloc(&buf, pkt->size);
if (ret < 0)
return ret;
av_assert1(!pkt->size || pkt->data);
if (pkt->size)
memcpy(buf->data, pkt->data, pkt->size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment