[PATCH] MPC/APE, Segmentation fault

Clemens Fuchslocher clemens at nospam.allesdurcheinander.de
Fri May 13 16:30:18 CEST 2005


Hello,

I am using the Musepack Decoder Plugin from http://www.musepack.net/
to play MPC files with XMMS. This plugin is using the TagLib library
to access the meta-data of the MPC files. Some MPC files cause a
Segmentation fault in a copy constructor of the String class inside
the TagLib library:

-=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-=
$ gdb xmms
[...]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 22727)]
0x4096f652 in TagLib::String::String () from /usr/lib/libtag.so.1
(gdb) backtrace
#0  0x4096f652 in TagLib::String::String () from /usr/lib/libtag.so.1
#1  0x4096eeb6 in TagLib::APE::Item::toString () from /usr/lib/libtag.so.1
#2  0x4073d0f7 in getTags () from /usr/local/xmms/lib/xmms/Input/libmpc.so
[...]
-=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-=



The following patch prevents this Segmentation fault (but I am not sure
if this is the correct way to fix the problem):

-=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-=
--- apeitem.cpp	2004-11-06 18:27:20.000000000 +0100
+++ apeitem.cpp	2005-05-07 16:12:59.000000000 +0200
@@ -111,6 +111,9 @@
 
 String APE::Item::toString() const
 {
+  if(isEmpty())
+    return "";
+
   return d->text.front();
 }
-=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-=
-- 


More information about the taglib-devel mailing list