mirror of
https://github.com/mpv-player/mpv
synced 2024-12-23 23:32:26 +00:00
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.
This commit is contained in:
parent
696a8c5609
commit
828a952c9a
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -155,6 +155,7 @@ static bool check_file_seg(struct MPContext *mpctx, struct demuxer **sources,
|
||||
{
|
||||
bool was_valid = false;
|
||||
struct demuxer_params params = {
|
||||
.matroska_num_wanted_uids = num_sources,
|
||||
.matroska_wanted_uids = uid_map,
|
||||
.matroska_wanted_segment = segment,
|
||||
.matroska_was_valid = &was_valid,
|
||||
|
Loading…
Reference in New Issue
Block a user