1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

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
This commit is contained in:
Vittorio Giovara 2015-03-09 00:05:30 +00:00
parent bfeb83a8b7
commit 9f25a10992

View File

@ -920,8 +920,11 @@ static int mkv_write_chapters(AVFormatContext *s)
int chapterstart = av_rescale_q(c->start, c->time_base, scale); int chapterstart = av_rescale_q(c->start, c->time_base, scale);
int chapterend = av_rescale_q(c->end, c->time_base, scale); int chapterend = av_rescale_q(c->end, c->time_base, scale);
AVDictionaryEntry *t = NULL; 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; return AVERROR_INVALIDDATA;
}
chapteratom = start_ebml_master(pb, MATROSKA_ID_CHAPTERATOM, 0); chapteratom = start_ebml_master(pb, MATROSKA_ID_CHAPTERATOM, 0);
put_ebml_uint(pb, MATROSKA_ID_CHAPTERUID, c->id); put_ebml_uint(pb, MATROSKA_ID_CHAPTERUID, c->id);