History

matroskaenc: Validate chapter start and end times

Vittorio Giovara committed 11 years ago

Commit 5dc47a21 parent f8c17191 file · +6 −4Browse files

Unified · Split

libavformat/matroskaenc.c+6−4
@@ -915,14 +915,16 @@ static int mkv_write_chapters(AVFormatContext *s) · 914 unmodified lines
915915 for (i = 0; i < s->nb_chapters; i++) {
916916 ebml_master chapteratom, chapterdisplay;
917917 AVChapter *c = s->chapters[i];
918+ int chapterstart = av_rescale_q(c->start, c->time_base, scale);
919+ int chapterend = av_rescale_q(c->end, c->time_base, scale);
918920 AVDictionaryEntry *t = NULL;
921+ if (chapterstart < 0 || chapterstart > chapterend)
922+ return AVERROR_INVALIDDATA;
919923
920924 chapteratom = start_ebml_master(pb, MATROSKA_ID_CHAPTERATOM, 0);
921925 put_ebml_uint(pb, MATROSKA_ID_CHAPTERUID, c->id);
922− put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMESTART,
923− av_rescale_q(c->start, c->time_base, scale));
924− put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMEEND,
925− av_rescale_q(c->end, c->time_base, scale));
926+ put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMESTART, chapterstart);
927+ put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMEEND, chapterend);
926928 put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGHIDDEN , 0);
927929 put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGENABLED, 1);
928930 if ((t = av_dict_get(c->metadata, "title", NULL, 0))) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t