[MPlayer-dev-eng] [patch] "-playlist radios.asx" crash mplayer

Rémi Guyomarch rguyom at pobox.com
Mon Apr 22 23:05:28 CEST 2002


The included .asx file will crash mplayer cvs-current.
The problem seems to be the detection of EOF. This file ends with an
empty line and the parser/loader doesn't seem to like it.

MPlayer crash in strncpy() called from line 89 of playtreeparser.c
because line_end - p->iter == 0.

I'm including a patch which seems to fix the crash but it can be total
junk, since I can't grok a single line of this damn
play_tree_parser_get_line() function ! ;)

-- 
Rémi
-------------- next part --------------
<ASX>
  <REPEAT>
    <PARAM NAME="cache" VALUE="1024" />
    <REPEAT>
    <ENTRY>
      <TITLE>SomaFM Presents: Secret Agent 128k</TITLE>
      <REF href="http://server2.somafm.com:8000" />
      <REF href="http://64.247.28.3:8020" />
      <REF href="http://k.no.bs:8000" />
    </ENTRY>
    </REPEAT>
    <REPEAT>
    <ENTRY>
      <TITLE>SomaFM Presents: squid downtempo 128k</TITLE>
      <REF href="http://server2.somafm.com:8012" />
      <REF href="http://k.no.bs:8012" />
    </ENTRY>
    </REPEAT>
    <REPEAT>
    <ENTRY>
      <TITLE>Epiphany Radio</TITLE>
      <REF href="http://64.124.11.21:9000" />
    </ENTRY>
    </REPEAT>
    <REPEAT>
    <ENTRY>
      <TITLE>SomaFM Presents: Groove Salad 128k</TITLE>
      <REF href="http://205.188.234.66:8066" />
      <REF href="http://205.188.234.68:8010" />
      <REF href="http://205.188.234.68:8012" />
      <REF href="http://205.188.234.35:8066" />
      <REF href="http://205.188.245.133:8076" />
      <REF href="http://server2.somafm.com:8032" />
      <REF href="http://k.no.bs:8032" />
    </ENTRY>
    </REPEAT>
    <REPEAT>
    <ENTRY>
      <TITLE>SomaFM Presents: Drone Zone 128k</TITLE>
      <REF href="http://server2.somafm.com:8002" />
      <REF href="http://k.no.bs:8002" />
    </ENTRY>
    </REPEAT>
    <REPEAT>
    <ENTRY>
      <TITLE>Monkey Radio</TITLE>
      <REF href="http://205.188.245.132:8038" />
      <REF href="http://205.188.245.131:8038" />
    </ENTRY>
    </REPEAT>
    <REPEAT>
    <ENTRY>
      <TITLE>SomaFM Presents: squid dnb 128k</TITLE>
      <REF href="http://server2.somafm.com:8014" />
      <REF href="http://k.no.bs:8014" />
    </ENTRY>
    </REPEAT>
    <ENTRY>
      <TITLE>Chill Ambience</TITLE>
      <REF href="http://chillambience.org:8000" />
    </ENTRY>
    </REPEAT>
    <ENTRY>
      <TITLE>BlueMars</TITLE>
      <REF href="http://scastsrv4.shoutcast.com:8010" />
    </ENTRY>
    </REPEAT>
    </REPEAT>
    <ENTRY>
      <TITLE>CryoSleep</TITLE>
      <REF href="http://scastsrv4.shoutcast.com:8016" />
    </ENTRY>
    </REPEAT>
 </REPEAT>
</ASX>
-------------- next part --------------
Index: playtreeparser.c
===================================================================
RCS file: /cvsroot/mplayer/main/playtreeparser.c,v
retrieving revision 1.8
diff -u -u -r1.8 playtreeparser.c
--- playtreeparser.c	22 Apr 2002 18:42:42 -0000	1.8
+++ playtreeparser.c	22 Apr 2002 21:06:28 -0000
@@ -86,7 +86,12 @@
   p->line = (char*)realloc(p->line,line_end - p->iter+1);
   if(!p->line)
     return NULL;
-  strncpy(p->line,p->iter,line_end - p->iter);
+  if(line_end - p->iter > 0)
+    strncpy(p->line,p->iter,line_end - p->iter);
+  else {
+    free(p->line);
+    return NULL;
+  }
   p->line[line_end - p->iter] = '\0';
   if(end != '\0')
     end++;


More information about the MPlayer-dev-eng mailing list