From 1c8b01ccbcfedcfad83fdd51a6e74a96b2fb1cd6 Mon Sep 17 00:00:00 2001 From: Stefan Andersson Date: Wed, 16 Apr 2025 11:58:45 +0200 Subject: [PATCH] matroska-demux: Prevent corrupt cluster duplication Make sure to always update next_cluster_offset, if next cluster offset isn't known set it to zero. If next_cluster_offfset isn't updated it will be the same as current and if the cluster parsing fails the same cluster will be parsed again leading to duplication of the data in the cluster. Part-of: --- subprojects/gst-plugins-good/gst/matroska/matroska-demux.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c b/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c index f3019406e3..0af51af0a7 100644 --- a/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c +++ b/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c @@ -6033,9 +6033,11 @@ gst_matroska_demux_parse_id (GstMatroskaDemux * demux, guint32 id, demux->seek_block = 0; } demux->seek_first = FALSE; - /* record next cluster for recovery */ + /* record next cluster for recovery, set to 0 if offset isn't known. */ if (read != G_MAXUINT64) demux->next_cluster_offset = demux->cluster_offset + read; + else + demux->next_cluster_offset = 0; /* eat cluster prefix */ gst_matroska_demux_flush (demux, needed); break;