[vlc-commits] demux: mkv: fix use after free (cid #1049107)

Francois Cartegnie git at videolan.org
Sat Nov 30 21:34:48 CET 2013


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Nov 30 21:10:51 2013 +0100| [6e245f46d63e407be6fff99f30ea9dd3d734c8e8] | committer: Francois Cartegnie

demux: mkv: fix use after free (cid #1049107)

GetMainName() can return a pointer to temporary string::

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

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

diff --git a/modules/demux/mkv/demux.cpp b/modules/demux/mkv/demux.cpp
index be20476..a0e8e89 100644
--- a/modules/demux/mkv/demux.cpp
+++ b/modules/demux/mkv/demux.cpp
@@ -684,9 +684,8 @@ bool demux_sys_t::PreloadLinked()
                 // TODO use a name for each edition, let the TITLE deal with a codec name
                 if ( p_title->psz_name == NULL )
                 {
-                    const char* psz_tmp = p_ved->GetMainName().c_str();
-                    if( *psz_tmp != '\0' )
-                        p_title->psz_name = strdup( psz_tmp );
+                    if( p_ved->GetMainName().length() )
+                        p_title->psz_name = strdup( p_ved->GetMainName().c_str() );
                     else
                     {
                         /* Check in tags if the edition has a name */



More information about the vlc-commits mailing list