[FFmpeg-cvslog] mov: Prevent segfaults on mov_write_hdlr_tag
Luca Barbato
git at videolan.org
Tue Aug 20 12:56:26 CEST 2013
ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Mon Aug 19 17:18:23 2013 +0200| [67400f6b6219892ab7a555fb61ef979c857692d7] | committer: Luca Barbato
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.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=67400f6b6219892ab7a555fb61ef979c857692d7
---
libavformat/movenc.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 0f21ae2..b83b0c0 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);
}
}
More information about the ffmpeg-cvslog
mailing list