From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Aug 6 14:50:09 2003 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2A3C137B404 for ; Wed, 6 Aug 2003 14:50:09 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B34D243FB1 for ; Wed, 6 Aug 2003 14:50:07 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h76Lo7Up066597 for ; Wed, 6 Aug 2003 14:50:07 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h76Lo7OW066596; Wed, 6 Aug 2003 14:50:07 -0700 (PDT) Resent-Date: Wed, 6 Aug 2003 14:50:07 -0700 (PDT) Resent-Message-Id: <200308062150.h76Lo7OW066596@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Melvyn Sopacua Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 67D9B37B401 for ; Wed, 6 Aug 2003 14:42:04 -0700 (PDT) Received: from ghost.lan.webteckies.org (node123e0.a2000.nl [24.132.35.224]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2477243F3F for ; Wed, 6 Aug 2003 14:42:03 -0700 (PDT) (envelope-from root@webteckies.org) Received: by ghost.lan.webteckies.org (Postfix, from userid 0) id CD56C21BBD; Wed, 6 Aug 2003 23:41:25 +0200 (CEST) Message-Id: <20030806214125.CD56C21BBD@ghost.lan.webteckies.org> Date: Wed, 6 Aug 2003 23:41:25 +0200 (CEST) From: Melvyn Sopacua To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 cc: MAINTAINER Subject: ports/55323: [PATCH] Segfault in audio/icecast2 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Aug 2003 21:50:09 -0000 >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: =================================================================== 0 /tmp ices.log 4 0 Stream 1 Example genre A short description of your stream playlist basic playlist.txt 0 0 192.168.1.10 8000 password stripped /example1.ogg 2 5 80 64000 44100 2 =================================================================== 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: