[vlc-commits] [Git][videolan/vlc][master] 2 commits: contrib: ebml: do not allow infinite size on the EBML head
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Apr 30 11:46:49 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
a8da8dcb by Steve Lhomme at 2026-04-30T11:08:50+00:00
contrib: ebml: do not allow infinite size on the EBML head
This will allow false detection of an invalid EBML header.
Submitted upstream [^1] but will need a new release as it might break the ABI.
Ref. #29578
[^1]: https://github.com/Matroska-Org/libebml/pull/328
- - - - -
f2d8e617 by Steve Lhomme at 2026-04-30T11:08:50+00:00
contrib: matroska: do not allow infinite sizes on most Master elements
This will allow false detection of an EBML elements.
Only Segment [^1] and Clusters [^2] are allowed to be infinite
and they use a different macro.
Submitted upstream [^3] but will need a new release as it might break the ABI.
Ref. #29578
[^1]: https://www.rfc-editor.org/rfc/rfc9559#section-5.1
[^2]: https://www.rfc-editor.org/rfc/rfc9559#section-5.1.3
[^3]: https://github.com/Matroska-Org/libmatroska/pull/234
- - - - -
4 changed files:
- + contrib/src/ebml/0001-EbmlHead-do-not-allow-to-have-an-infinite-unknown-si.patch
- contrib/src/ebml/rules.mak
- + contrib/src/matroska/0001-KaxDefines-do-not-allow-infinite-sizes-on-all-Master.patch
- contrib/src/matroska/rules.mak
Changes:
=====================================
contrib/src/ebml/0001-EbmlHead-do-not-allow-to-have-an-infinite-unknown-si.patch
=====================================
@@ -0,0 +1,28 @@
+From 4ad8d9335f593d767f319b61ba5dc531fb2c3e52 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Fri, 25 Jul 2025 14:37:18 +0200
+Subject: [PATCH] EbmlHead: do not allow to have an infinite/unknown size
+
+It does not have [^1] unknownsizeallowed set to true (default to false)
+
+[^1]: https://www.rfc-editor.org/rfc/rfc8794.html#section-11.2.1
+---
+ ebml/EbmlHead.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/ebml/EbmlHead.h b/ebml/EbmlHead.h
+index b575b79..9768b5f 100644
+--- a/ebml/EbmlHead.h
++++ b/ebml/EbmlHead.h
+@@ -46,6 +46,8 @@ DECLARE_EBML_MASTER(EbmlHead)
+ EbmlHead(const EbmlHead & ElementToClone) = default;
+
+ EBML_CONCRETE_CLASS(EbmlHead)
++
++ bool SetSizeInfinite(bool finite = true) override { return !finite; }
+ };
+
+ } // namespace libebml
+--
+2.52.0.windows.1
+
=====================================
contrib/src/ebml/rules.mak
=====================================
@@ -17,6 +17,7 @@ ebml: libebml-$(EBML_VERSION).tar.xz .sum-ebml
$(APPLY) $(SRC)/ebml/0001-EbmlString-ReadFully-use-automatic-memory-management.patch
$(APPLY) $(SRC)/ebml/0002-EbmlUnicodeString-use-std-string-when-reading-instea.patch
$(APPLY) $(SRC)/ebml/0001-EbmlMaster-fix-leak-when-reading-upper-level-element.patch
+ $(APPLY) $(SRC)/ebml/0001-EbmlHead-do-not-allow-to-have-an-infinite-unknown-si.patch
$(MOVE)
.ebml: ebml toolchain.cmake
=====================================
contrib/src/matroska/0001-KaxDefines-do-not-allow-infinite-sizes-on-all-Master.patch
=====================================
@@ -0,0 +1,37 @@
+From 3c0d992c17acb32b5e57b228afac8e74eb773baf Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Mon, 27 Apr 2026 11:54:02 +0200
+Subject: [PATCH] KaxDefines: do not allow infinite sizes on all Master
+ elements except Segment+Cluster
+
+Only Segment [^1] and Clusters [^2] are allowed to be infinite.
+
+[^1]: https://www.rfc-editor.org/rfc/rfc9559#section-5.1
+[^2]: https://www.rfc-editor.org/rfc/rfc9559#section-5.1.3
+---
+ matroska/KaxDefines.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/matroska/KaxDefines.h b/matroska/KaxDefines.h
+index 7734eb4..d29f6ab 100644
+--- a/matroska/KaxDefines.h
++++ b/matroska/KaxDefines.h
+@@ -62,6 +62,7 @@
+ class MATROSKA_DLL_API x : public EbmlMaster { \
+ public: x(EBML_EXTRA_PARAM); \
+ x(const x & ElementToClone) :EbmlMaster(ElementToClone) {} \
++ bool SetSizeInfinite(bool finite = true) override { return !finite; } \
+ EBML_CONCRETE_CLASS(x)
+
+ #define DECLARE_MKX_MASTER_CONS(x) DECLARE_MKX_CONTEXT(x) \
+@@ -150,6 +151,7 @@ class MATROSKA_DLL_API x : public EbmlMaster { \
+ class MATROSKA_DLL_API x : public EbmlMaster { \
+ public: x(); \
+ x(const x & ElementToClone) :EbmlMaster(ElementToClone) {} \
++ bool SetSizeInfinite(bool finite = true) override { return !finite; } \
+ EBML_CONCRETE_CLASS(x)
+
+ #define DECLARE_MKX_MASTER_CONS(x) DECLARE_MKX_CONTEXT(x) \
+--
+2.52.0.windows.1
+
=====================================
contrib/src/matroska/rules.mak
=====================================
@@ -19,6 +19,7 @@ $(TARBALLS)/libmatroska-$(MATROSKA_VERSION).tar.xz:
matroska: libmatroska-$(MATROSKA_VERSION).tar.xz .sum-matroska
$(UNPACK)
$(call pkg_static,"libmatroska.pc.in")
+ $(APPLY) $(SRC)/matroska/0001-KaxDefines-do-not-allow-infinite-sizes-on-all-Master.patch
$(APPLY) $(SRC)/matroska/0001-KaxBlock-release-read-buffers-on-EndOfStream-error.patch
$(APPLY) $(SRC)/matroska/0001-KaxBlock-fix-leak-when-reading-EBML-lace-is-aborted.patch
$(MOVE)
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/25ef539aaa4d4c843ee18ee6309aeff520f12ab9...f2d8e617c8112a190e674d133676f46c69c34e01
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/25ef539aaa4d4c843ee18ee6309aeff520f12ab9...f2d8e617c8112a190e674d133676f46c69c34e01
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list