diff options
author | wm4 <wm4@nowhere> | 2014-03-26 17:07:53 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-03-26 17:07:53 +0100 |
commit | 5afef03a7076a64058a0c7d7de0780ddff0bdc7c (patch) | |
tree | 48847dfec91f8c8da60ccdb7b177b44a7f528ae3 /player/command.c | |
parent | 3ad2a67d3f7f063ac6ed5dbeddbe74fe4032b5c7 (diff) | |
download | mpv-5afef03a7076a64058a0c7d7de0780ddff0bdc7c.tar.bz2 mpv-5afef03a7076a64058a0c7d7de0780ddff0bdc7c.tar.xz |
player: fix unchecked access for chapter metadata
It's possible that MPContext has a chapter list, but the demuxer
doesn't. In this case, accesing the chapter-metadata property would
lead to invalid accesses.
(This fixes the out of bound access, but in theory, the returned data
can still be incorrect, since MPContext chapters don't need to map
directly to demuxer chapters.)
Diffstat (limited to 'player/command.c')
-rw-r--r-- | player/command.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/player/command.c b/player/command.c index 52a98fff86..dd9bf9e45d 100644 --- a/player/command.c +++ b/player/command.c @@ -894,11 +894,9 @@ static int mp_property_chapter_metadata(m_option_t *prop, int action, void *arg, { struct demuxer *demuxer = mpctx->master_demuxer; int chapter = get_current_chapter(mpctx); - if (!demuxer || chapter < 0) + if (!demuxer || chapter < 0 || chapter >= demuxer->num_chapters) return M_PROPERTY_UNAVAILABLE; - assert(chapter < demuxer->num_chapters); - return tag_property(prop, action, arg, demuxer->chapters[chapter].metadata); } |