From 571aac15d8f6d4d33d188df7086e0aa7d7e9cffc Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Sun, 25 Feb 2024 14:35:15 +0100 Subject: [PATCH] spectools: use a callback in EbmlCallbacks to validate the size of an element So it can be checked even before the element is created. --- spectool/schema_2_kaxsemantic_cpp.xsl | 11 +++++++++++ spectool/schema_2_kaxsemantic_h.xsl | 12 ++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/spectool/schema_2_kaxsemantic_cpp.xsl b/spectool/schema_2_kaxsemantic_cpp.xsl index 19d18ca6..536ae7ca 100644 --- a/spectool/schema_2_kaxsemantic_cpp.xsl +++ b/spectool/schema_2_kaxsemantic_cpp.xsl @@ -176,6 +176,17 @@ static constexpr const MatroskaProfile VERSION_WEBM_UP_TO_V4 = {true, false, 0, + + , KaxInternalBlock::SizeIsValid + , libebml::EbmlBinary::SizeIsValid + + , Kax + + + + ::SizeIsValid + + diff --git a/spectool/schema_2_kaxsemantic_h.xsl b/spectool/schema_2_kaxsemantic_h.xsl index 06dc3024..f66c4480 100644 --- a/spectool/schema_2_kaxsemantic_h.xsl +++ b/spectool/schema_2_kaxsemantic_h.xsl @@ -67,7 +67,6 @@ namespace libmatroska { DECLARE_MKX_BINARY - _LENGTH DECLARE_MKX_UINTEGER @@ -98,9 +97,6 @@ namespace libmatroska { - - , - ) public: @@ -108,6 +104,14 @@ namespace libmatroska { libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter) override; + + static inline bool SizeIsValid(std::uint64_t Size) {return Size + + + == + + ;} + };