[vlc-commits] demux:mkv: go one level up in the parser if we found nothing at the current level

Steve Lhomme git at videolan.org
Wed Jan 24 08:46:31 CET 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Jan 22 15:33:07 2018 +0100| [12299d0708be3d1c49c33843f375015c3510765a] | committer: Jean-Baptiste Kempf

demux:mkv: go one level up in the parser if we found nothing at the current level

It's OK to find nothing if the data was all garbage and dummy we skipped.

The check on the EOF is necessary as there's no way to tell if we found nothing
because of EOF or because we reached the end of the Max size to read without
anything useful.

Fixes #19512

(cherry picked from commit 64f1615ae0627086d5fba94e7bc70f32d494691f)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=12299d0708be3d1c49c33843f375015c3510765a
---

 modules/demux/mkv/Ebml_parser.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/modules/demux/mkv/Ebml_parser.cpp b/modules/demux/mkv/Ebml_parser.cpp
index 139d93f312..b765f088b8 100644
--- a/modules/demux/mkv/Ebml_parser.cpp
+++ b/modules/demux/mkv/Ebml_parser.cpp
@@ -204,6 +204,13 @@ EbmlElement *EbmlParser::Get( int n_call )
                      m_es->FindNextElement( e_context,
                                             i_ulev, i_max_read,
                                             (  mb_dummy | (mi_level > 1) ), 1 );
+
+    if( m_el[mi_level] == NULL )
+    {
+        if ( i_max_read != UINT64_MAX && !static_cast<vlc_stream_io_callback *>(&m_es->I_O())->IsEOF() )
+            i_ulev = 1; /* found nothing valid anymore at this level, go up */
+    }
+
     if( i_ulev > 0 )
     {
         if( p_prev )



More information about the vlc-commits mailing list