[vlc-commits] Fixed potential NULL deference in dvdnav plugin.

Laurent Aimar git at videolan.org
Sat Dec 10 20:15:51 CET 2011


vlc/vlc-1.2 | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Dec 10 16:08:23 2011 +0100| [01fc8320851b59e823c578e816215bbcf31db22f] | committer: Jean-Baptiste Kempf

Fixed potential NULL deference in dvdnav plugin.
(cherry picked from commit 51b80d6fc0d81d0d31984d408d104df604bf9794)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=01fc8320851b59e823c578e816215bbcf31db22f
---

 modules/access/dvdnav.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index c462ef2..2a7d647 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -1001,32 +1001,33 @@ static void DemuxTitles( demux_t *p_demux )
     {
         int32_t i_chapters;
         uint64_t i_title_length;
+        uint64_t *p_chapters_time;
 
 #if defined(HAVE_DVDNAV_DESCRIBE_TITLE_CHAPTERS)
-        uint64_t *p_chapters_time = NULL;
         i_chapters = dvdnav_describe_title_chapters( p_sys->dvdnav, i,
                                                      &p_chapters_time,
                                                      &i_title_length );
         if( i_chapters < 1 )
+        {
             i_title_length = 0;
+            p_chapters_time = NULL;
+        }
 #else
         if( dvdnav_get_number_of_parts( p_sys->dvdnav, i, &i_chapters ) != DVDNAV_STATUS_OK )
             i_chapters = 0;
         i_title_length = 0;
+        p_chapters_time = NULL;
 #endif
         t = vlc_input_title_New();
         t->i_length = i_title_length * 1000 / 90;
         for( int j = 0; j < __MAX( i_chapters, 1 ); j++ )
         {
             s = vlc_seekpoint_New();
-#if defined(HAVE_DVDNAV_DESCRIBE_TITLE_CHAPTERS)
-            s->i_time_offset = p_chapters_time[j] * 1000 / 90;
-#endif
+            if( p_chapters_time )
+                s->i_time_offset = p_chapters_time[j] * 1000 / 90;
             TAB_APPEND( t->i_seekpoint, t->seekpoint, s );
         }
-#if defined(HAVE_DVDNAV_DESCRIBE_TITLE_CHAPTERS)
         free( p_chapters_time );
-#endif
         TAB_APPEND( p_sys->i_title, p_sys->title, t );
     }
 }



More information about the vlc-commits mailing list