diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2013-08-19 17:18:23 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2013-08-20 00:22:58 +0200 |
commit | 67400f6b6219892ab7a555fb61ef979c857692d7 (patch) | |
tree | 5c90b2e5f65e385e321c2533659b3f81482eccfd | |
parent | 22de0f8369f1f3edf1a55e1d275f3c07c617b53e (diff) | |
download | ffmpeg-67400f6b6219892ab7a555fb61ef979c857692d7.tar.gz |
mov: Prevent segfaults on mov_write_hdlr_tag
Do not segfault when writing tracks such as tmcd by writing them down
as generic DataHandlers if not known.
-rw-r--r-- | libavformat/movenc.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 0f21ae2747..b83b0c09e2 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1239,11 +1239,11 @@ static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track) const char *hdlr, *descr = NULL, *hdlr_type = NULL; int64_t pos = avio_tell(pb); - if (!track) { /* no media --> data handler */ - hdlr = "dhlr"; - hdlr_type = "url "; - descr = "DataHandler"; - } else { + hdlr = "dhlr"; + hdlr_type = "url "; + descr = "DataHandler"; + + if (track) { hdlr = (track->mode == MODE_MOV) ? "mhlr" : "\0\0\0\0"; if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) { hdlr_type = "vide"; @@ -1258,6 +1258,17 @@ static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track) } else if (track->enc->codec_tag == MKTAG('r','t','p',' ')) { hdlr_type = "hint"; descr = "HintHandler"; + } else if (track->enc->codec_tag == MKTAG('t','m','c','d')) { + hdlr_type = "tmcd"; + descr = "TimeCodeHandler"; + } else { + char tag_buf[32]; + av_get_codec_tag_string(tag_buf, sizeof(tag_buf), + track->enc->codec_tag); + + av_log(track->enc, AV_LOG_WARNING, + "Unknown hldr_type for %s / 0x%04X, writing dummy values\n", + tag_buf, track->enc->codec_tag); } } |