<div dir="ltr">Fixes #9623<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 20, 2015 at 3:34 PM, Steve Lhomme <span dir="ltr"><<a href="mailto:git@videolan.org" target="_blank">git@videolan.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">vlc | branch: master | Steve Lhomme <<a href="mailto:robux4@gmail.com">robux4@gmail.com</a>> | Wed Feb 18 16:12:33 2015 +0000| [11a5d4f4c05cf4eb089967f09561c158083495fb] | committer: Jean-Baptiste Kempf<br>
<br>
MKV: Don't allow Matroska Void/CRC32 elements fallback when looking for a level 1 element<br>
<br>
Slightly better version with the right macros to access the semantic<br>
context master.<br>
<br>
Signed-off-by: Jean-Baptiste Kempf <<a href="mailto:jb@videolan.org">jb@videolan.org</a>><br>
<br>
> <a href="http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=11a5d4f4c05cf4eb089967f09561c158083495fb" target="_blank">http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=11a5d4f4c05cf4eb089967f09561c158083495fb</a><br>
---<br>
<br>
modules/demux/mkv/Ebml_parser.cpp | 29 ++++++++++++++++++++++++++++-<br>
modules/demux/mkv/Ebml_parser.hpp | 1 +<br>
2 files changed, 29 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/modules/demux/mkv/Ebml_parser.cpp b/modules/demux/mkv/Ebml_parser.cpp<br>
index 21e219e..a42b936 100644<br>
--- a/modules/demux/mkv/Ebml_parser.cpp<br>
+++ b/modules/demux/mkv/Ebml_parser.cpp<br>
@@ -146,6 +146,28 @@ void EbmlParser::Reset( demux_t *p_demux )<br>
mb_dummy = var_InheritBool( p_demux, "mkv-use-dummy" );<br>
}<br>
<br>
+<br>
+// Define a special Segment context that doesn't allow void/crc32 elements<br>
+static const EbmlSemanticContext & GetEbmlNoGlobal_Context();<br>
+static const EbmlSemanticContext Context_EbmlNoGlobal = EbmlSemanticContext(0, NULL, NULL, *GetEbmlNoGlobal_Context, NULL);<br>
+static const EbmlSemantic EbmlNoGlobal_ContextList[0] =<br>
+{<br>
+ //EbmlSemantic(false, false, EBML_INFO(EbmlCrc32)), ///< EbmlCrc32<br>
+ //EbmlSemantic(false, false, EBML_INFO(EbmlVoid)), ///< EbmlVoid<br>
+};<br>
+static const EbmlSemanticContext EbmlNoGlobal_Context = EbmlSemanticContext(countof(EbmlNoGlobal_ContextList), EbmlNoGlobal_ContextList, NULL, *GetEbmlNoGlobal_Context, NULL);<br>
+static const EbmlSemanticContext & GetEbmlNoGlobal_Context()<br>
+{<br>
+ return EbmlNoGlobal_Context;<br>
+}<br>
+<br>
+// the Segment Context should not allow Void or CRC32 elements to avoid lookup false alarm<br>
+const EbmlSemanticContext Context_KaxSegmentVLC = EbmlSemanticContext(KaxSegment_Context.GetSize(),<br>
+ KaxSegment_Context.MyTable,<br>
+ KaxSegment_Context.Parent(),<br>
+ GetEbmlNoGlobal_Context,<br>
+ KaxSegment_Context.GetMaster());<br>
+<br>
EbmlElement *EbmlParser::Get( int n_call )<br>
{<br>
int i_ulev = 0;<br>
@@ -170,8 +192,13 @@ EbmlElement *EbmlParser::Get( int n_call )<br>
<br>
}<br>
<br>
+ // ignore global Void/CRC32 elements when looking for level 1 elements in the Segment<br>
+ EbmlSemanticContext e_context =<br>
+ EBML_CTX_MASTER( EBML_CONTEXT(m_el[mi_level - 1]) ) == EBML_CTX_MASTER( Context_KaxSegmentVLC )<br>
+ ? Context_KaxSegmentVLC<br>
+ : EBML_CONTEXT(m_el[mi_level - 1]);<br>
/* Ignore unknown level 0 or 1 elements */<br>
- m_el[mi_level] = m_es->FindNextElement( EBML_CONTEXT(m_el[mi_level - 1]),<br>
+ m_el[mi_level] = m_es->FindNextElement( e_context,<br>
i_ulev, UINT64_MAX,<br>
( mb_dummy | (mi_level > 1) ), 1 );<br>
if( i_ulev > 0 )<br>
diff --git a/modules/demux/mkv/Ebml_parser.hpp b/modules/demux/mkv/Ebml_parser.hpp<br>
index 57fdf23..96f9f4b 100644<br>
--- a/modules/demux/mkv/Ebml_parser.hpp<br>
+++ b/modules/demux/mkv/Ebml_parser.hpp<br>
@@ -60,6 +60,7 @@ class EbmlParser<br>
<br>
int mi_user_level;<br>
bool mb_keep;<br>
+ /* Allow dummy/unknown EBML elements */<br>
bool mb_dummy;<br>
};<br>
<br>
<br>
_______________________________________________<br>
vlc-commits mailing list<br>
<a href="mailto:vlc-commits@videolan.org">vlc-commits@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/vlc-commits" target="_blank">https://mailman.videolan.org/listinfo/vlc-commits</a><br>
</blockquote></div><br></div>