aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/nutdec.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-12-18 15:18:47 +0100
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-12-20 13:39:33 +0100
commit38f8c80901033042488579c8975efb39ab153793 (patch)
treed2bea8c3251483cf7805e983d624219a86e63555 /libavformat/nutdec.c
parent945ae04fab4513ee724751d908e87a3447c3e609 (diff)
downloadffmpeg-38f8c80901033042488579c8975efb39ab153793.tar.gz
nutdec: only copy the header if it exists
Fixes ubsan runtime error: null pointer passed as argument 2, which is declared to never be null Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> (cherry picked from commit 9f82506c79874edd7b09707ab63d9e72078de8f9) Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavformat/nutdec.c')
-rw-r--r--libavformat/nutdec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 63b0cd2fb9..201c34e0e9 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -1126,7 +1126,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
if (stc->last_flags & FLAG_SM_DATA) {
int sm_size;