[MPlayer-dev-eng] [PATCH] Crash when invalid file is supplied as a playlist

Jernej Azarija stdazi at gmail.com
Mon Sep 24 16:27:32 CEST 2007


Hello!

I've noticed that if `mplayer -playlist' is supplied with a directory
- a segfault occurs :

===
azi at localhost ~ $ mplayer -playlist /etc/
MPlayer dev-SVN-rUNKNOWN-4.1.2 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Core(TM)2 Duo CPU     T7300  @ 2.00GHz (Family: 6,
Model: 15, Stepping: 10)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2
Segmentation fault
===


The whole playtreeparser.c looks quite buggy although the above patch
fixes the mentioned segfault (which occurs because of a NULL ptr being
supplied to strncasecmp)

Index: playtreeparser.c
===================================================================
--- playtreeparser.c    (revision 24596)
+++ playtreeparser.c    (working copy)
@@ -459,6 +459,9 @@
   mp_msg(MSGT_PLAYTREE,MSGL_V,"Detected smil playlist format\n");
   play_tree_parser_stop_keeping(p);

+  if (line == NULL) /* end of file reached */
+         return NULL;
+
   if (strncasecmp(line,"(smil-document",14)==0) {
     mp_msg(MSGT_PLAYTREE,MSGL_V,"Special smil-over-realrtsp playlist
header\n");
     is_rmsmil = 1;

That way mplayer acts correctly :

===
azi at localhost ~/mplayer $ ./mplayer -playlist /etc/
MPlayer dev-SVN-r24596-4.1.2 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Core(TM)2 Duo CPU     T7300  @ 2.00GHz (Family: 6,
Model: 15, Stepping: 10)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2
Error while parsing playlist
Warning: empty playlist
Error parsing option on the command line: -playlist
===

It'll be reasonable to redesign the playlist code to even not bother
opening weird files such as directories.

Jernej Azarija.



More information about the MPlayer-dev-eng mailing list