Hi,
the attached patch updates libshout to version 2.2; changes are listed in the patch itself.
2.2 is very close to what I tested for a very long time on i386 with aggressive MALLOC_OPTIONS, and another extensive test with ices and ices2 shows that it's still good on i386.
This breaks net/ices until it is adjusted (patch follows in a separate mail.)
Moritz
* Update to libshout-2.2 (new: Speex support and bugfixes) * Enable Theora support * Use devel/pkgconfig now -- more consistent, but it'll break net/ices! (net/ices update comes next) * PNF * Patch maintenance * Fix another double-free() that, unfortunately, didn't make it into 2.2 in time diff -pruN --exclude=CVS /usr/ports/net/libshout/Makefile ./Makefile --- /usr/ports/net/libshout/Makefile Sun Jan 1 11:23:39 2006 +++ ./Makefile Fri Jan 6 14:32:04 2006 @@ -2,9 +2,8 @@ COMMENT= "library for communicating with an icecast server" -DISTNAME= libshout-2.1 -PKGNAME= ${DISTNAME}p2 -SHARED_LIBS= shout 4.0 +DISTNAME= libshout-2.2 +SHARED_LIBS= shout 5.0 MODGNU_SHARED_LIBS= shout '' CATEGORIES= net audio @@ -21,15 +20,17 @@ WANTLIB= m ogg MASTER_SITES= http://downloads.xiph.org/releases/libshout/ -LIB_DEPENDS= vorbis.4::audio/libvorbis +BUILD_DEPENDS= ::devel/pkgconfig \ + speex.4::audio/speex +LIB_DEPENDS= vorbis.4::audio/libvorbis \ + theora.1::multimedia/libtheora -USE_LIBTOOL= Yes +FAKE_FLAGS= docdir='${PREFIX}/share/examples/libshout' + CONFIGURE_STYLE=gnu -CONFIGURE_ARGS= ${CONFIGURE_SHARED} --disable-pkgconfig \ - --without-theora +CONFIGURE_ARGS+=${CONFIGURE_SHARED} SEPARATE_BUILD= simple - -FAKE_FLAGS= docdir='${PREFIX}/share/examples/libshout' +USE_LIBTOOL= Yes .include <bsd.port.mk> diff -pruN --exclude=CVS /usr/ports/net/libshout/distinfo ./distinfo --- /usr/ports/net/libshout/distinfo Sun Jan 1 11:23:39 2006 +++ ./distinfo Fri Jan 6 12:30:06 2006 @@ -1,4 +1,4 @@ -MD5 (libshout-2.1.tar.gz) = ca6e98af87fd17c709821d9be82b37d5 -RMD160 (libshout-2.1.tar.gz) = edcbf2c8111bd76ce27734513a4c483986ba2e7e -SHA1 (libshout-2.1.tar.gz) = c251d0791d807762957235442fa9b777f3f6068c -SIZE (libshout-2.1.tar.gz) = 455243 +MD5 (libshout-2.2.tar.gz) = d5b273a072785ee14a85ff76f66850aa +RMD160 (libshout-2.2.tar.gz) = fb1697ce5e95a8e54168656d5a9a735cbb68c972 +SHA1 (libshout-2.2.tar.gz) = e059116226d05758192575db2965017f28424860 +SIZE (libshout-2.2.tar.gz) = 472875 diff -pruN --exclude=CVS /usr/ports/net/libshout/patches/patch-src_avl_avl_c ./patches/patch-src_avl_avl_c --- /usr/ports/net/libshout/patches/patch-src_avl_avl_c Tue Apr 19 22:23:44 2005 +++ ./patches/patch-src_avl_avl_c Sat Dec 31 14:11:30 2005 @@ -1,6 +1,6 @@ $OpenBSD: patch-src_avl_avl_c,v 1.4 2005/04/19 20:23:44 sturm Exp $ --- src/avl/avl.c.orig Mon Jul 5 22:44:13 2004 -+++ src/avl/avl.c Tue Apr 19 22:18:54 2005 ++++ src/avl/avl.c Sat Dec 31 14:11:23 2005 @@ -35,6 +35,7 @@ #include <stdio.h> @@ -9,12 +9,14 @@ $OpenBSD: patch-src_avl_avl_c,v 1.4 2005 #include "avl.h" -@@ -1063,9 +1064,11 @@ typedef struct _link_node { +@@ -1062,10 +1063,12 @@ typedef struct _link_node { + static char balance_chars[3] = {'\\', '-', '/'}; - static int +-static int -default_key_printer (char * buffer, void * key) -+default_key_printer (char * buffer, size_t size, void * key) ++static unsigned int ++default_key_printer (char * buffer, unsigned int size, void * key) { - return sprintf (buffer, "%p", key); + snprintf (buffer, size, "%p", key); @@ -23,13 +25,11 @@ $OpenBSD: patch-src_avl_avl_c,v 1.4 2005 } /* -@@ -1108,8 +1111,8 @@ print_node (avl_key_printer_fun_type key - link_node * link) +@@ -1109,7 +1112,7 @@ print_node (avl_key_printer_fun_type key { char buffer[256]; -- unsigned int width; + unsigned int width; - width = key_printer (buffer, node->key); -+ size_t width; + width = key_printer (buffer, sizeof(buffer), node->key); if (node->right) { diff -pruN --exclude=CVS /usr/ports/net/libshout/patches/patch-src_avl_avl_h ./patches/patch-src_avl_avl_h --- /usr/ports/net/libshout/patches/patch-src_avl_avl_h Tue Apr 19 22:07:11 2005 +++ ./patches/patch-src_avl_avl_h Sat Dec 31 14:11:30 2005 @@ -1,12 +1,12 @@ $OpenBSD: patch-src_avl_avl_h,v 1.1 2005/04/19 20:07:11 sturm Exp $ ---- src/avl/avl.h.orig Sun Apr 17 02:44:39 2005 -+++ src/avl/avl.h Sun Apr 17 02:45:06 2005 +--- src/avl/avl.h.orig Mon Jul 5 22:44:13 2004 ++++ src/avl/avl.h Sat Dec 31 14:10:34 2005 @@ -55,7 +55,7 @@ typedef int (*avl_key_compare_fun_type) typedef int (*avl_iter_fun_type) (void * key, void * iter_arg); typedef int (*avl_iter_index_fun_type) (unsigned long index, void * key, void * iter_arg); typedef int (*avl_free_key_fun_type) (void * key); -typedef int (*avl_key_printer_fun_type) (char *, void *); -+typedef int (*avl_key_printer_fun_type) (char *, size_t, void *); ++typedef unsigned int (*avl_key_printer_fun_type) (char *, unsigned int, void *); /* * <compare_fun> and <compare_arg> let us associate a particular compare diff -pruN --exclude=CVS /usr/ports/net/libshout/patches/patch-src_shout_c ./patches/patch-src_shout_c --- /usr/ports/net/libshout/patches/patch-src_shout_c Tue Apr 19 22:07:11 2005 +++ ./patches/patch-src_shout_c Fri Jan 6 12:31:10 2006 @@ -1,7 +1,36 @@ $OpenBSD: patch-src_shout_c,v 1.1 2005/04/19 20:07:11 sturm Exp $ ---- src/shout.c.orig Sun Apr 17 12:25:25 2005 -+++ src/shout.c Sun Apr 17 12:51:32 2005 -@@ -489,7 +489,7 @@ int shout_set_mount(shout_t *self, const +--- src/shout.c.orig Tue Jan 3 19:56:39 2006 ++++ src/shout.c Fri Jan 6 12:30:31 2006 +@@ -165,6 +165,8 @@ int shout_close(shout_t *self) + if (self->close) + self->close(self); + ++ self->close = NULL; ++ self->send = NULL; + sock_close(self->socket); + self->state = SHOUT_STATE_UNCONNECTED; + self->starttime = 0; +@@ -183,6 +185,9 @@ int shout_send(shout_t *self, const unsi + if (self->state != SHOUT_STATE_CONNECTED) + return self->error = SHOUTERR_UNCONNECTED; + ++ if (self->send == NULL) ++ return self->error = SHOUTERR_NOCONNECT; ++ + if (self->starttime <= 0) + self->starttime = timing_get_time(); + +@@ -202,6 +207,9 @@ ssize_t shout_send_raw(shout_t *self, co + if (self->state != SHOUT_STATE_CONNECTED) + return SHOUTERR_UNCONNECTED; + ++ if (self->send == NULL) ++ return self->error = SHOUTERR_NOCONNECT; ++ + self->error = SHOUTERR_SUCCESS; + + /* send immediately if possible (should be the common case) */ +@@ -489,7 +497,7 @@ int shout_set_mount(shout_t *self, const if (!(self->mount = malloc(len))) return self->error = SHOUTERR_MALLOC; @@ -10,44 +39,30 @@ $OpenBSD: patch-src_shout_c,v 1.1 2005/0 return self->error = SHOUTERR_SUCCESS; } -@@ -1145,6 +1145,7 @@ static char *http_basic_authorization(sh +@@ -1146,7 +1154,7 @@ static int create_http_request(shout_t * + static char *http_basic_authorization(shout_t *self) { char *out, *in; - int len; -+ int ret; +- int len; ++ size_t len; if (!self || !self->user || !self->password) return NULL; -@@ -1152,7 +1153,11 @@ static char *http_basic_authorization(sh +@@ -1154,7 +1162,7 @@ static char *http_basic_authorization(sh len = strlen(self->user) + strlen(self->password) + 2; if (!(in = malloc(len))) return NULL; - sprintf(in, "%s:%s", self->user, self->password); -+ ret = snprintf(in, len, "%s:%s", self->user, self->password); -+ if (ret == -1 || ret >= len) { -+ free(in); -+ return NULL; -+ } ++ snprintf(in, len, "%s:%s", self->user, self->password); out = _shout_util_base64_encode(in); free(in); -@@ -1161,10 +1166,15 @@ static char *http_basic_authorization(sh +@@ -1163,7 +1171,7 @@ static char *http_basic_authorization(sh free(out); return NULL; } - sprintf(in, "Authorization: Basic %s\r\n", out); -- free(out); -- -- return in; -+ ret = snprintf(in, len, "Authorization: Basic %s\r\n", out); -+ if (ret == -1 || ret >= len) { -+ free(in); -+ free(out); -+ return NULL; -+ } else { -+ free(out); -+ return in; -+ } - } - - static int parse_response(shout_t *self) ++ snprintf(in, len, "Authorization: Basic %s\r\n", out); + free(out); + + return in; diff -pruN --exclude=CVS /usr/ports/net/libshout/patches/patch-src_util_c ./patches/patch-src_util_c --- /usr/ports/net/libshout/patches/patch-src_util_c Tue Aug 23 01:25:39 2005 +++ ./patches/patch-src_util_c Sat Dec 31 11:23:50 2005 @@ -1,6 +1,6 @@ $OpenBSD: patch-src_util_c,v 1.2 2005/08/22 23:25:39 pvalchev Exp $ --- src/util.c.orig Sun Mar 21 05:03:34 2004 -+++ src/util.c Fri Aug 19 21:04:04 2005 ++++ src/util.c Sat Dec 31 11:23:42 2005 @@ -254,6 +254,7 @@ char *_shout_util_dict_urlencode(util_di char *res, *tmp; char *enc; @@ -9,25 +9,18 @@ $OpenBSD: patch-src_util_c,v 1.2 2005/08 for (res = NULL; dict; dict = dict->next) { /* encode key */ -@@ -265,21 +266,39 @@ char *_shout_util_dict_urlencode(util_di +@@ -265,21 +266,24 @@ char *_shout_util_dict_urlencode(util_di return NULL; } if (start) { - if (!(res = malloc(strlen(enc) + 1))) { -+ int ret; -+ + buflen = strlen(enc) + 1; + if ((res = malloc(buflen)) == NULL) { free(enc); return NULL; } - sprintf(res, "%s", enc); -+ ret = snprintf(res, buflen, "%s", enc); -+ if (ret == -1 || ret >= buflen) { -+ free(enc); -+ free(res); -+ return NULL; -+ } ++ snprintf(res, buflen, "%s", enc); free(enc); start = 0; } else { @@ -37,24 +30,15 @@ $OpenBSD: patch-src_util_c,v 1.2 2005/08 free(enc); free(res); return NULL; -- } else -+ } else { -+ int ret; -+ + } else res = tmp; - sprintf(res + strlen(res), "%c%s", delim, enc); -+ ret = snprintf(res + strlen(res), buflen - strlen(res), -+ "%c%s", delim, enc); -+ if (ret == -1 || ret >= buflen - strlen(res)) { -+ free(enc); -+ free(res); -+ return NULL; -+ } -+ } ++ snprintf(res + strlen(res), buflen - strlen(res), ++ "%c%s", delim, enc); free(enc); } -@@ -291,14 +310,25 @@ char *_shout_util_dict_urlencode(util_di +@@ -291,13 +295,14 @@ char *_shout_util_dict_urlencode(util_di return NULL; } @@ -64,23 +48,10 @@ $OpenBSD: patch-src_util_c,v 1.2 2005/08 free(enc); free(res); return NULL; -- } else -+ } else { -+ int ret; -+ size_t reslen; + } else res = tmp; - sprintf(res + strlen(res), "=%s", enc); -- free(enc); -+ reslen = strlen(res); -+ ret = snprintf(res + reslen, buflen - reslen, "=%s", enc); -+ if (ret == -1 || ret >= buflen - reslen) { -+ free(enc); -+ free(res); -+ return NULL; -+ } -+ free(enc); -+ enc = NULL; -+ } ++ snprintf(res + strlen(res), buflen - strlen(res), "=%s", enc); + free(enc); } - return res; diff -pruN --exclude=CVS /usr/ports/net/libshout/pkg/PLIST ./pkg/PLIST --- /usr/ports/net/libshout/pkg/PLIST Sun Feb 27 20:14:40 2005 +++ ./pkg/PLIST Fri Jan 6 12:56:01 2006 @@ -1,13 +1,15 @@ @comment $OpenBSD: PLIST,v 1.4 2005/02/27 19:14:40 naddy Exp $ -bin/shout-config include/shout/ include/shout/shout.h lib/libshout.a lib/libshout.la +lib/pkgconfig/ +lib/pkgconfig/shout.pc share/aclocal/ share/aclocal/shout.m4 share/examples/libshout/ @comment share/examples/libshout/COPYING [EMAIL PROTECTED] share/examples/libshout/NEWS @comment share/examples/libshout/README share/examples/libshout/example.c share/examples/libshout/nonblocking.c