[vlc-commits] demux:mkv: don't crash if a child element has an unknown size and the parent doesn't

Steve Lhomme git at videolan.org
Wed Dec 6 11:53:09 CET 2017


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Wed Dec  6 10:31:48 2017 +0100| [729469b775a345997ad8c6b2a4d9b93affb72efa] | committer: Hugo Beauzée-Luyssen

demux:mkv: don't crash if a child element has an unknown size and the parent doesn't

libebml should be fixed not to allow this.

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 modules/demux/mkv/Ebml_parser.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mkv/Ebml_parser.cpp b/modules/demux/mkv/Ebml_parser.cpp
index 3f9a3ae668..139d93f312 100644
--- a/modules/demux/mkv/Ebml_parser.cpp
+++ b/modules/demux/mkv/Ebml_parser.cpp
@@ -180,10 +180,10 @@ EbmlElement *EbmlParser::Get( int n_call )
     }
     else {
         size_t size_lvl = mi_level;
-        while ( size_lvl && m_el[size_lvl-1]->IsFiniteSize() &&
+        while ( size_lvl && m_el[size_lvl-1]->IsFiniteSize() && m_el[size_lvl]->IsFiniteSize() &&
                 m_el[size_lvl-1]->GetEndPosition() == m_el[size_lvl]->GetEndPosition() )
             size_lvl--;
-        if (size_lvl == 0 || !m_el[size_lvl-1]->IsFiniteSize() )
+        if (size_lvl == 0 || !m_el[size_lvl-1]->IsFiniteSize() || !m_el[size_lvl]->IsFiniteSize() )
             i_max_read = UINT64_MAX;
         else {
             uint64 top = m_el[size_lvl-1]->GetEndPosition();



More information about the vlc-commits mailing list