Date: Wed, 6 Aug 2003 23:41:25 +0200 (CEST) From: Melvyn Sopacua <melvyn@webteckies.org> To: FreeBSD-gnats-submit@FreeBSD.org Cc: MAINTAINER <michaelnottebrock@gmx.net> Subject: ports/55323: [PATCH] Segfault in audio/icecast2 Message-ID: <20030806214125.CD56C21BBD@ghost.lan.webteckies.org> Resent-Message-ID: <200308062150.h76Lo7OW066596@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 55323 >Category: ports >Synopsis: [PATCH] Segfault in audio/icecast2 >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Aug 06 14:50:07 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Melvyn Sopacua >Release: FreeBSD 4.8-STABLE i386 >Organization: >Environment: System: FreeBSD ghost.lan.webteckies.org 4.8-STABLE FreeBSD 4.8-STABLE #2: Sat Aug 2 19:45:34 CEST 2003 root@ghost.lan.webteckies.org:/usr/obj/usr/src/sys/GHOST i386 >Description: A segfault occurs, with ices in playlist mode. A little background: ices: IceS 2.0beta2 (up-to-date port) libshout: libshout 2.0 icecast: Icecast2-20021112 (up-to-date port) My icecast.xml config file, is basically the example file, with some actual values, and no upstream server. If needed, I can provide it, but I don't think it's relevant to the bug. My ices.xml config file (cleaned up comments and whitespace) is available here: =================================================================== <?xml version="1.0"?> <ices> <background>0</background> <logpath>/tmp</logpath> <logfile>ices.log</logfile> <loglevel>4</loglevel> <consolelog>0</consolelog> <stream> <metadata> <name>Stream 1</name> <genre>Example genre</genre> <description>A short description of your stream</description> </metadata> <input> <module>playlist</module> <param name="type">basic</param> <param name="file">playlist.txt</param> <param name="random">0</param> <param name="once">0</param> </input> <instance> <hostname>192.168.1.10</hostname> <port>8000</port> <password>password stripped</password> <mount>/example1.ogg</mount> <reconnectdelay>2</reconnectdelay> <reconnectattempts>5</reconnectattempts> <maxqueuelength>80</maxqueuelength> <encode> <nominal-bitrate>64000</nominal-bitrate> <samplerate>44100</samplerate> <channels>2</channels> </encode> </instance> </stream> </ices> =================================================================== The ogg file, has been encoded with -b 64000 --managed and a all comments have been set. >How-To-Repeat: 1) Run icecast, with a valid config file. 2) Then run ices, setup to connect to that server. 3) observe the core dump: (gdb) run -c /home/mdev/local/etc/icecast.xml Starting program: /usr/local/bin/icecast -c /home/mdev/local/etc/icecast.xml Program received signal SIGSEGV, Segmentation fault. 0x804e252 in source_main (arg=0x80598c0) at source.c:148 148 stats_event(source->mount, "type", source->format->format_description); (gdb) print *source $1 = {client = 0x8059700, con = 0x8059660, parser = 0x805d180, mount = 0x805d420 "/example1.ogg", format = 0x0, client_tree = 0x8083c80, pending_tree = 0x8083e80, shutdown_rwlock = 0x805881c} Notice, that source->format is NULL. >Fix: The following is a work-around for the issue, checking the availibility of source->format. The proper fix, is probably to "find out why". I haven't tried current CVS of icecast2, yet. files/patch-src::source.c: =================================================================== --- src/source.c.orig Sun Oct 6 11:57:07 2002 +++ src/source.c Wed Aug 6 22:11:56 2003 @@ -98,7 +98,8 @@ client_destroy(source->client); avl_tree_free(source->pending_tree, _free_client); avl_tree_free(source->client_tree, _free_client); - source->format->free_plugin(source->format); + if (source->format) + source->format->free_plugin(source->format); free(source); return 1; @@ -145,6 +146,11 @@ stats_event(source->mount, "bitrate", s); if ((s = httpp_getvar(source->parser, "ice-description"))) stats_event(source->mount, "description", s); + if (source->format == NULL) + { + WARN0("Bad data from source"); + goto done; + } stats_event(source->mount, "type", source->format->format_description); while (global.running == ICE_RUNNING) { =================================================================== Additionally, I've added a NO_STRIP option, to the Makefile, to make debugging this issue, a little easier (you will still need -g in CFLAGS of /etc/make.conf): Index: Makefile =================================================================== RCS file: /home/ncvs/ports/audio/icecast2/Makefile,v retrieving revision 1.29 diff -u -r1.29 Makefile --- Makefile 5 Mar 2003 10:17:47 -0000 1.29 +++ Makefile 6 Aug 2003 21:38:49 -0000 @@ -49,6 +49,11 @@ ${WRKSRC}/win32/res/Makefile \ ${WRKSRC}/win32/Makefile \ ${WRKSRC}/Makefile +.ifdef NO_STRIP + @${REINPLACE_CMD} -e 's|-c -s -o root|-c -o root|' ${WRKSRC}/Makefile \ + ${WRKSRC}/src/Makefile +.endif + post-install: .if !defined(NOPORTDOCS) ${MKDIR} ${DOCSDIR} >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030806214125.CD56C21BBD>