[FFmpeg-devel] [PATCH] lavf/matroskaenc: fix crash on empty H.264 packets
Rodger Combs
rodger.combs at gmail.com
Wed Jun 24 11:21:15 CEST 2015
Fixes:
ffmpeg -i https://dl.dropboxusercontent.com/u/105828/sample%20crash%20file.mkv \
-bsf:v h264_mp4toannexb -c copy -y -f matroska /dev/null
Not 100% sure if this is the best place to do this.
---
libavformat/matroskaenc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 3b525ad..37d9caa 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1568,7 +1568,8 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb,
avio_tell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration,
keyframe != 0);
if (codec->codec_id == AV_CODEC_ID_H264 && codec->extradata_size > 0 &&
- (AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))
+ (AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1) &&
+ pkt->data)
ff_avc_parse_nal_units_buf(pkt->data, &data, &size);
else if (codec->codec_id == AV_CODEC_ID_HEVC && codec->extradata_size > 6 &&
(AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))
--
2.4.1
More information about the ffmpeg-devel
mailing list