demux_cue: remove cue tracks which have a null filename.

This can happen if the file references a track, but does not specify
an INDEX 01 for it. This would cause mpv to just segfault due to
dereferencing the null pointer as a string.

A file causing this was observed in the wild by
ExactAudioCopy v0.99pb4 for a disk that contained a data track at the
end.
This commit is contained in:
Kevin Mitchell 2015-12-16 23:40:21 -08:00
parent f36c17d715
commit ad80cc4eee
1 changed files with 12 additions and 2 deletions

View File

@ -150,8 +150,18 @@ static void build_timeline(struct timeline *tl)
add_source(tl, tl->demuxer);
struct cue_track *tracks = p->f->tracks;
size_t track_count = p->f->num_tracks;
struct cue_track *tracks = NULL;
size_t track_count = 0;
for (size_t n = 0; n < p->f->num_tracks; n++) {
struct cue_track *track = &p->f->tracks[n];
if (track->filename) {
MP_TARRAY_APPEND(ctx, tracks, track_count, *track);
} else {
MP_WARN(tl->demuxer, "No file specified for track entry %zd. "
"It will be removed\n", n + 1);
}
}
if (track_count == 0) {
MP_ERR(tl, "CUE: no tracks found!\n");