From 5e54a871c5e38225a3575c92196b1355f7744f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sun, 28 Jan 2024 04:19:36 +0100 Subject: [PATCH] demux_mkv: error if needed compression settings were not found Mode 3 is header stripping and we need ContentCompSettings to reconstruct the data. Found by fuzzing. --- demux/demux_mkv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index 3b37c863ac..50f4c78b25 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -390,6 +390,10 @@ static bstr demux_mkv_decode(struct mp_log *log, mkv_track_t *track, } size = dstlen - out_avail; } else if (enc->comp_algo == 3) { + if (enc->comp_settings_len == 0 || !enc->comp_settings) { + mp_warn(log, "missing comp_settings, unable to reconstruct the data.\n"); + goto error; + } dest = talloc_size(track->parser_tmp, size + enc->comp_settings_len); memcpy(dest, enc->comp_settings, enc->comp_settings_len); memcpy(dest + enc->comp_settings_len, src, size);