summaryrefslogtreecommitdiffstats
path: root/demux/demux_mf.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-03-19 01:54:45 +0100
committerwm4 <wm4@nowhere>2013-03-19 01:54:45 +0100
commitbe7e04f7198ed6092a1d1e54e867df9b2c6247a4 (patch)
tree5719fd9763e4ee3bf736e1be588a59c1aa88ab7f /demux/demux_mf.c
parentb242aa366bc10b0dd0504f3c3c916e4e61e4f81b (diff)
downloadmpv-be7e04f7198ed6092a1d1e54e867df9b2c6247a4.tar.bz2
mpv-be7e04f7198ed6092a1d1e54e867df9b2c6247a4.tar.xz
demux_mf: fix crashes when '*' matches directories
Doing 'mpv mf://*' in a file with directories would crash, because even though directories are skipped, the corresponding file entry is just left at NULL, leading to a segfault on access. So explicitly skip NULL entries.
Diffstat (limited to 'demux/demux_mf.c')
-rw-r--r--demux/demux_mf.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/demux/demux_mf.c b/demux/demux_mf.c
index 236718de36..0db3fb8add 100644
--- a/demux/demux_mf.c
+++ b/demux/demux_mf.c
@@ -70,8 +70,11 @@ static int demux_mf_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds){
if (mf->streams)
entry_stream = mf->streams[mf->curr_frame];
struct stream *stream = entry_stream;
- if (!stream)
- stream = open_stream(mf->names[mf->curr_frame], demuxer->opts, NULL);
+ if (!stream) {
+ char *filename = mf->names[mf->curr_frame];
+ if (filename)
+ stream = open_stream(filename, demuxer->opts, NULL);
+ }
if (stream) {
stream_seek(stream, 0);
@@ -87,7 +90,7 @@ static int demux_mf_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds){
talloc_free(data.start);
}
- if (stream != entry_stream)
+ if (stream && stream != entry_stream)
free_stream(stream);
mf->curr_frame++;