summaryrefslogtreecommitdiffstats
path: root/demux/cue.c
diff options
context:
space:
mode:
authorKevin Mitchell <kevmitch@gmail.com>2015-12-17 01:40:31 -0800
committerKevin Mitchell <kevmitch@gmail.com>2015-12-17 12:38:57 -0800
commit7137afeb2c466135ab0e01ee0f9cbd2abd000563 (patch)
tree04d3531660fc9f6ed2a0ebee538a95e3b77eae78 /demux/cue.c
parentad80cc4eeec506fddd11e2a29d0b1868b3ca8170 (diff)
downloadmpv-7137afeb2c466135ab0e01ee0f9cbd2abd000563.tar.bz2
mpv-7137afeb2c466135ab0e01ee0f9cbd2abd000563.tar.xz
demux: check embedded cuesheet refers to only one file
If someone was "clever" enough to embed a cuesheet referencing multiple files, mpv would create a bunch of nonsense chapter markers.
Diffstat (limited to 'demux/cue.c')
-rw-r--r--demux/cue.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/demux/cue.c b/demux/cue.c
index d72e84249b..50ce4b7639 100644
--- a/demux/cue.c
+++ b/demux/cue.c
@@ -218,3 +218,18 @@ struct cue_file *mp_parse_cue(struct bstr data)
return f;
}
+
+int mp_check_embedded_cue(struct cue_file *f)
+{
+ char *fn0 = f->tracks[0].filename;
+ for (int n = 1; n < f->num_tracks; n++) {
+ char *fn = f->tracks[n].filename;
+ // both filenames have the same address (including NULL)
+ if (fn0 == fn)
+ continue;
+ // only one filename is NULL, or the strings don't match
+ if (!fn0 || !fn || strcmp(fn0, fn) != 0)
+ return -1;
+ }
+ return 0;
+}