[Flac-dev] XMMS plugin: string handling bugs

Christian Weisgerber naddy at mips.inka.de
Tue Mar 8 14:56:25 PST 2005


There are problems in the configure option handling code for http
streaming that was added to the XMMS plugin for 1.1.2.

In configure.c, flac_cfg.stream.proxy_host and other pointers to
strings are initialized with pointers to an empty string "".
Subsequent code in FLAC_XMMS__init() and flac_configurewin_ok()
passes these pointers to g_free().  Since they don't point to memory
that was ever allocated through malloc(), what happens next is
undefined.

I guess on the author's system free() silently copes.  With some
malloc debugging (malloc.conf -> A on BSD systems), free() will
abort().

I tried initializing the pointers to NULL, but that resulted at
least in one assert from Gtk, so there is both code that assumes
that the pointers point to something and code that assumes the
memory can be free()ed.  For the time being, I added some extra
initializations like

  flac_cfg.stream.proxy_host = g_strdup("");

to FLAC_XMMS__init(), but somebody familiar with the code (Steven
Richman?) ought to clean this up.

-- 
Christian "naddy" Weisgerber                          naddy at mips.inka.de


More information about the Flac-dev mailing list