diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-12-18 15:18:47 +0100 |
---|---|---|
committer | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-12-20 16:13:36 +0100 |
commit | 2306964b3a0336e24d1c9d04bd54aaecf2d198d7 (patch) | |
tree | 69ee1dbc2046e54f12198248c0fffaa05825cb3f | |
parent | e7b09eaefa5d117c79e23d7c70732249af383b2a (diff) | |
download | ffmpeg-2306964b3a0336e24d1c9d04bd54aaecf2d198d7.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>
-rw-r--r-- | libavformat/nutdec.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 76fd8cc554..eec64235ef 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -1082,7 +1082,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; |