[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
Mon Jan 22 15:46:51 CET 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Jan 22 15:33:07 2018 +0100| [64f1615ae0627086d5fba94e7bc70f32d494691f] | committer: Steve Lhomme

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

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=64f1615ae0627086d5fba94e7bc70f32d494691f
---

 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 1595da4ba2..29cf6b3d30 100644
--- a/modules/demux/mkv/Ebml_parser.cpp
+++ b/modules/demux/mkv/Ebml_parser.cpp
@@ -205,6 +205,13 @@ next:
                      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