# HG changeset patch # User siretart # Date 1281715091 0 # Node ID 253f7779fe982bcca13686c872f2ba5b0ec8822a # Parent e9458f705c3ff256959294cd00916252bf9476b0 sanity check to avoid a segmentation fault in playtree.c on empty playlists. This is Debian Bug: http://bugs.debian.org/591525 diff -r e9458f705c3f -r 253f7779fe98 playtree.c --- a/playtree.c Fri Aug 13 11:08:30 2010 +0000 +++ b/playtree.c Fri Aug 13 15:58:11 2010 +0000 @@ -218,8 +218,15 @@ 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