diff options
author | Kevin Mitchell <kevmitch@gmail.com> | 2015-12-16 23:40:21 -0800 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2015-12-17 12:38:53 -0800 |
commit | ad80cc4eeec506fddd11e2a29d0b1868b3ca8170 (patch) | |
tree | 70d83d342dd2c4f39bb886d7144e5670be5d9fe8 /demux | |
parent | f36c17d7152891180ea4ccb4226be197f3bbfd13 (diff) | |
download | mpv-ad80cc4eeec506fddd11e2a29d0b1868b3ca8170.tar.bz2 mpv-ad80cc4eeec506fddd11e2a29d0b1868b3ca8170.tar.xz |
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.
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux_cue.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/demux/demux_cue.c b/demux/demux_cue.c index 43420573ec..da84fc60c1 100644 --- a/demux/demux_cue.c +++ b/demux/demux_cue.c @@ -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"); |