aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/avpacket.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2019-02-14 22:36:46 +0100
committerMarton Balint <cus@passwd.hu>2019-03-01 22:32:32 +0100
commit9f8854cb5ad98e1b6456099e38c06d5eba3431ca (patch)
treefbfd589180e583ecfc384bfc6652a162f98e291b /libavcodec/avpacket.c
parent57580e2ab68d94e70c0cfd7c3b48eb0d6d0a02d0 (diff)
downloadffmpeg-9f8854cb5ad98e1b6456099e38c06d5eba3431ca.tar.gz
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: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavcodec/avpacket.c')
-rw-r--r--libavcodec/avpacket.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 11ac4e80cd..8f0603df78 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -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);