diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-03-09 00:05:30 +0000 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-03-09 12:57:19 +0000 |
commit | 9f25a109922da43c1f81273a431d3b40cb5a785a (patch) | |
tree | 6e71a1b5c188e6780849516dfa1d9f756e76b666 /libavformat/matroskaenc.c | |
parent | bfeb83a8b7d3fcf09a54d8dbc9c521e10bb17530 (diff) | |
download | ffmpeg-9f25a109922da43c1f81273a431d3b40cb5a785a.tar.gz |
matroskaenc: Also validate chapter end time
This prevents it to be written as unsigned. Also add an error message.
CC: libav-stable@libav.org
Bug-Id: CID 1265717
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r-- | libavformat/matroskaenc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 868861615f..f4d2665c2b 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -920,8 +920,11 @@ static int mkv_write_chapters(AVFormatContext *s) 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) + if (chapterstart < 0 || chapterstart > chapterend || chapterend < 0) { + av_log(s, AV_LOG_ERROR, "Invalid chapter start (%d) or end (%d).\n", + chapterstart, chapterend); return AVERROR_INVALIDDATA; + } chapteratom = start_ebml_master(pb, MATROSKA_ID_CHAPTERATOM, 0); put_ebml_uint(pb, MATROSKA_ID_CHAPTERUID, c->id); |