[MPlayer-cvslog] r33599 - trunk/mplayer.c

reimar subversion at mplayerhq.hu
Sun Jun 12 11:57:29 CEST 2011


Author: reimar
Date: Sun Jun 12 11:57:07 2011
New Revision: 33599

Log:
Make mp_dvdnav_save_smpi more robust and ensure consistency of nav buffer.

It seems that in_size could be negative sometimes, this would
cause crashes if the malloc somehow succeeded.

Modified:
   trunk/mplayer.c

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	Sun Jun 12 11:17:05 2011	(r33598)
+++ trunk/mplayer.c	Sun Jun 12 11:57:07 2011	(r33599)
@@ -2080,12 +2080,17 @@ static void mp_dvdnav_save_smpi(int in_s
         return;
 
     free(mpctx->nav_buffer);
+    mpctx->nav_buffer  = NULL;
+    mpctx->nav_start   = NULL;
+    mpctx->nav_in_size = -1;
 
+    if (in_size > 0)
     mpctx->nav_buffer  = malloc(in_size);
+    if (mpctx->nav_buffer) {
     mpctx->nav_start   = start;
-    mpctx->nav_in_size = mpctx->nav_buffer ? in_size : -1;
-    if (mpctx->nav_buffer)
+        mpctx->nav_in_size = in_size;
         memcpy(mpctx->nav_buffer, start, in_size);
+    }
 
     if (decoded_frame && mpctx->nav_smpi != decoded_frame)
         mpctx->nav_smpi = mp_dvdnav_copy_mpi(mpctx->nav_smpi, decoded_frame);


More information about the MPlayer-cvslog mailing list