[MPlayer-dev-eng] [BUG][PATCH] Crash in video_filter_init when using GUI with pp

Raindel Shachar raindel at techunix.technion.ac.il
Wed Mar 19 23:22:08 CET 2003


  The GUI has used incorrect data type for vo_plugin_args, and that caused
SEGV later, when the vf sub-system tried to setup the filters. I attach a
patch that fixes it.

  Regards
  Shachar

PS: someone should (IMHO) get 10l for this.
-------------- next part --------------
diff -ur original/Gui/interface.c patchtest/Gui/interface.c
--- original/Gui/interface.c	Tue Feb 11 21:21:12 2003
+++ patchtest/Gui/interface.c	Wed Mar 19 23:45:34 2003
@@ -39,6 +39,15 @@
 #include "../libmpdemux/stheader.h"
 #include "../libmpcodecs/dec_video.h"
 
+
+#ifdef NEW_CONFIG
+  #include "../m_option.h"
+  #include "../m_config.h"
+#else
+  #include "../cfgparser.h"
+#endif
+#include "../cfg-mplayer-def.h"
+
 guiInterface_t guiIntfStruct;
 int guiWinID=-1;
 
@@ -343,7 +352,7 @@
 extern vo_functions_t * video_out;
 extern int    		frame_dropping;
 extern int              stream_dump_type;
-extern char **          vo_plugin_args;
+extern m_obj_settings_t*vo_plugin_args;
 
 #if defined( USE_OSD ) || defined( USE_SUB )
 void guiLoadFont( void )
@@ -439,10 +448,10 @@
  if ( vo_plugin_args )
   {
    int i = 0;
-   while ( vo_plugin_args[i] ) if ( !gstrcmp( vo_plugin_args[i++],str ) ) { i=-1; break; }
+   while ( vo_plugin_args[i].name ) if ( !gstrcmp( vo_plugin_args[i++].name,str ) ) { i=-1; break; }
    if ( i != -1 )
-     { vo_plugin_args=realloc( vo_plugin_args,( i + 2 ) * sizeof( char * ) ); vo_plugin_args[i]=strdup( str ); vo_plugin_args[i+1]=NULL; }
-  } else { vo_plugin_args=malloc( 2 * sizeof( char * ) ); vo_plugin_args[0]=strdup( str ); vo_plugin_args[1]=NULL; }
+     { vo_plugin_args=realloc( vo_plugin_args,( i + 2 ) * sizeof( m_obj_settings_t ) ); vo_plugin_args[i].name=strdup( str );vo_plugin_args[i].attribs = NULL; vo_plugin_args[i+1].name=NULL; }
+  } else { vo_plugin_args=malloc( 2 * sizeof(  m_obj_settings_t ) ); vo_plugin_args[0].name=strdup( str );vo_plugin_args[0].attribs = NULL; vo_plugin_args[1].name=NULL; }
 }
 
 static void remove_vop( char * str )
@@ -453,16 +462,16 @@
 
  mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[gui] remove video filter: %s\n",str );
 
- while ( vo_plugin_args[n++] ); n--;
+ while ( vo_plugin_args[n++].name ); n--;
  if ( n > -1 )
   {
    int i = 0,m = -1;
-   while ( vo_plugin_args[i] ) if ( !gstrcmp( vo_plugin_args[i++],str ) ) { m=i - 1; break; }
+   while ( vo_plugin_args[i].name ) if ( !gstrcmp( vo_plugin_args[i++].name,str ) ) { m=i - 1; break; }
    i--;
    if ( m > -1 )
     {
-     if ( n == 1 ) { free( vo_plugin_args[0] ); free( vo_plugin_args ); vo_plugin_args=NULL; }
-      else memcpy( &vo_plugin_args[i],&vo_plugin_args[i + 1],( n - i ) * sizeof( char * ) );
+     if ( n == 1 ) { free( vo_plugin_args[0].name );free( vo_plugin_args[0].attribs ); free( vo_plugin_args ); vo_plugin_args=NULL; }
+     else { free( vo_plugin_args[i].name );free( vo_plugin_args[i].attribs ); memcpy( &vo_plugin_args[i],&vo_plugin_args[i + 1],( n - i ) * sizeof( m_obj_settings_t ) ); }
     }
   }
 }
@@ -1084,12 +1093,6 @@
   return 1;
 }
 
-#ifdef NEW_CONFIG
-  #include "../m_option.h"
-  #include "../m_config.h"
-#else
-  #include "../cfgparser.h"
-#endif
 
 // This function imports the initial playtree (based on cmd-line files) into the gui playlist
 // by either:


More information about the MPlayer-dev-eng mailing list