nutdec: only copy the header if it exists
authorAndreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Fri, 18 Dec 2015 16:24:09 +0000 (17:24 +0100)
committerAnton Khirnov <anton@khirnov.net>
Wed, 13 Jan 2016 08:44:44 +0000 (09:44 +0100)
Fixes runtime error: null pointer passed as argument 2, which is
declared to never be null

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
libavformat/nutdec.c

index 17ae522..e39f7d3 100644 (file)
@@ -890,7 +890,8 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code)
     ret = av_new_packet(pkt, size + nut->header_len[header_idx]);
     if (ret < 0)
         return ret;
-    memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]);
+    if (nut->header[header_idx])
+        memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]);
     pkt->pos = avio_tell(bc); // FIXME
     avio_read(bc, pkt->data + nut->header_len[header_idx], size);