summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorBen Boeckel <mathstuf@gmail.com>2013-09-26 02:22:06 -0400
committerwm4 <wm4@nowhere>2013-09-26 18:20:32 +0200
commit828a952c9aa2d2f1427e1f21a6c1202c2191e5a9 (patch)
tree6806c731c26b4751ddfacc99f219d11a6a9c9b52 /demux
parent696a8c5609ca1bf260176cb9c43f483463a72c97 (diff)
downloadmpv-828a952c9aa2d2f1427e1f21a6c1202c2191e5a9.tar.bz2
mpv-828a952c9aa2d2f1427e1f21a6c1202c2191e5a9.tar.xz
matroska: fix uninitialized memory accesses with ordered chapters
There is uninitialized memory access if the actual size isn't passed along. In the worst case, this can cause a source to be loaded against the uninitialized memory, causing a false count of found versus required sources, preventing the "Failed to find ordered chapter part" message.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux.h1
-rw-r--r--demux/demux_mkv.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/demux/demux.h b/demux/demux.h
index c42c964fa9..af8766ec22 100644
--- a/demux/demux.h
+++ b/demux/demux.h
@@ -148,6 +148,7 @@ typedef struct demux_attachment
} demux_attachment_t;
struct demuxer_params {
+ int matroska_num_wanted_uids;
unsigned char (*matroska_wanted_uids)[16];
int matroska_wanted_segment;
bool *matroska_was_valid;
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index 03ffc84844..fec2e223d0 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -394,7 +394,7 @@ static int demux_mkv_read_info(demuxer_t *demuxer)
unsigned char (*uids)[16] = demuxer->params->matroska_wanted_uids;
if (!info.n_segment_uid)
uids = NULL;
- for (int i = 0; i < MP_TALLOC_ELEMS(uids); i++) {
+ for (int i = 0; i < demuxer->params->matroska_num_wanted_uids; i++) {
if (!memcmp(info.segment_uid.start, uids[i], 16))
goto out;
}