diff options
author | siretart <siretart@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-08-13 15:58:11 +0000 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-11-02 04:15:48 +0200 |
commit | 733dabb37eff4d9d26205837483964b2af82dd4b (patch) | |
tree | 7e85c692a8dd895277cf0ea48b724a5d23853aa2 /playtree.c | |
parent | 920ee4dc5303b4a3ff42d94ec9e27c513bf1c6b0 (diff) | |
download | mpv-733dabb37eff4d9d26205837483964b2af82dd4b.tar.bz2 mpv-733dabb37eff4d9d26205837483964b2af82dd4b.tar.xz |
playtree: fix segfault on empty playlist
Add a sanity check to avoid a segmentation fault in playtree.c on
empty playlists.
This is Debian Bug: http://bugs.debian.org/591525
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31960 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'playtree.c')
-rw-r--r-- | playtree.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/playtree.c b/playtree.c index c8a3cdf916..42762064c2 100644 --- a/playtree.c +++ b/playtree.c @@ -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 |