diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-02-03 15:40:34 +0000 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-02-17 11:27:41 -0500 |
commit | 5dc47a2bd52e375ed742c45d08356b45098f458d (patch) | |
tree | 3f7e3d4b0ab87861813d61e6f26f344b17808c99 /libavformat | |
parent | f8c1719771dc4ac2e13e6bc8bf741854a30e3a86 (diff) | |
download | ffmpeg-5dc47a2bd52e375ed742c45d08356b45098f458d.tar.gz |
matroskaenc: Validate chapter start and end times
CC: libav-stable@libav.org
Bug-Id: CID 1265717
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/matroskaenc.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 458a5f6cf7..cab43f499e 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -915,14 +915,16 @@ static int mkv_write_chapters(AVFormatContext *s) for (i = 0; i < s->nb_chapters; i++) { ebml_master chapteratom, chapterdisplay; AVChapter *c = s->chapters[i]; + int chapterstart = av_rescale_q(c->start, c->time_base, scale); + int chapterend = av_rescale_q(c->end, c->time_base, scale); AVDictionaryEntry *t = NULL; + if (chapterstart < 0 || chapterstart > chapterend) + return AVERROR_INVALIDDATA; chapteratom = start_ebml_master(pb, MATROSKA_ID_CHAPTERATOM, 0); put_ebml_uint(pb, MATROSKA_ID_CHAPTERUID, c->id); - put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMESTART, - av_rescale_q(c->start, c->time_base, scale)); - put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMEEND, - av_rescale_q(c->end, c->time_base, scale)); + put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMESTART, chapterstart); + put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMEEND, chapterend); put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGHIDDEN , 0); put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGENABLED, 1); if ((t = av_dict_get(c->metadata, "title", NULL, 0))) { |