[MPlayer-cvslog] r31960 - trunk/playtree.c

siretart subversion at mplayerhq.hu
Fri Aug 13 17:58:12 CEST 2010


Author: siretart
Date: Fri Aug 13 17:58:11 2010
New Revision: 31960

Log:
sanity check to avoid a segmentation fault in playtree.c on empty playlists.
This is Debian Bug: http://bugs.debian.org/591525

Modified:
   trunk/playtree.c

Modified: trunk/playtree.c
==============================================================================
--- trunk/playtree.c	Fri Aug 13 13:08:30 2010	(r31959)
+++ trunk/playtree.c	Fri Aug 13 17:58:11 2010	(r31960)
@@ -218,8 +218,15 @@ void
 play_tree_set_child(play_tree_t* pt, play_tree_t* child) {
   play_tree_t* iter;
 
+  /* Roughly validate input data. Both, pt and child are going to be
+   * dereferenced, hence assure they're not NULL.
+   */
+  if (!pt || !child) {
+    mp_msg(MSGT_PLAYTREE, MSGL_ERR, "Internal error, attempt to add an empty child or use empty playlist\n");
+    return;
+  }
+
 #ifdef MP_DEBUG
-  assert(pt != NULL);
   assert(pt->entry_type == PLAY_TREE_ENTRY_NODE);
 #endif
 


More information about the MPlayer-cvslog mailing list