[vlc-devel] [PATCH] mkv/demux: Ebml_Parser: fix #18001 (memory-leak)

Filip Roséen filip at atch.se
Thu Mar 2 17:41:00 CET 2017


The previous implementation would not free the previous element stored
in the parser stack if an unexpected element is encountered, leading
to a memory-leak.

fixes #18001

--

The implementation of EbmlParser is sadly too complicated to be easily
maintainable. This patch fixes the leak as described in the below
linked ticket, but the entire implementation should be rewritten to
prevent other cases where similar things might happen (since it is
currently a pain in the arse to properly check that things are in
order).

 - https://trac.videolan.org/vlc/ticket/18001

I will try to have an extensive set of patches fixing the issues as
soon as possible.
---
 modules/demux/mkv/Ebml_parser.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/modules/demux/mkv/Ebml_parser.cpp b/modules/demux/mkv/Ebml_parser.cpp
index 4e16c4bd48..c937a9900d 100644
--- a/modules/demux/mkv/Ebml_parser.cpp
+++ b/modules/demux/mkv/Ebml_parser.cpp
@@ -253,6 +253,8 @@ EbmlElement *EbmlParser::Get( int n_call )
             }
 
             delete m_el[mi_level];
+            delete p_prev;
+
             m_el[mi_level] = NULL;
             m_el[mi_level - 1]->SkipData( *m_es, EBML_CONTEXT(m_el[mi_level - 1]) );
             return Get();
-- 
2.12.0



More information about the vlc-devel mailing list