From 2e369b6908f1b4ecf41e92c6dd0b75dfe2a3bc07 Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 26 Nov 2007 20:35:27 +0000 Subject: [PATCH] 100l in play_tree_parser_get_line, check that there actually is a previous character before comparing it against '\r'. Fixes a possible crash on playlist file that is empty or starts with an empty line. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25169 b3059339-0415-0410-9bf9-f77b7e298cf2 --- playtreeparser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playtreeparser.c b/playtreeparser.c index f8132fd2ce..0d4c0fe43d 100644 --- a/playtreeparser.c +++ b/playtreeparser.c @@ -93,7 +93,7 @@ play_tree_parser_get_line(play_tree_parser_t* p) { break; } - line_end = ((*(end-1)) == '\r') ? end-1 : end; + line_end = (end > p->iter && *(end-1) == '\r') ? end-1 : end; if(line_end - p->iter >= 0) p->line = (char*)realloc(p->line,line_end - p->iter+1); else