Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 398571 - media-sound/id3v2-0.1.12 crashes when tagging mp3 with VBR due to a bug in media-libs/id3lib-3.8.3
Summary: media-sound/id3v2-0.1.12 crashes when tagging mp3 with VBR due to a bug in me...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Sound Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-11 19:41 UTC by Asaf Gery
Modified: 2018-08-18 21:00 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
.abcde.conf with lame configured to create VBR mp3 (.abcde.conf,11.72 KB, text/plain)
2012-01-11 19:41 UTC, Asaf Gery
Details
id3lib-3.8.3-vbr-overflow.patch (id3lib-3.8.3-vbr-overflow.patch,621 bytes, patch)
2012-01-11 20:00 UTC, Asaf Gery
Details | Diff
id3lib-3.8.3-r9.ebuild (id3lib-3.8.3-r9.ebuild,1.42 KB, text/plain)
2012-01-11 20:01 UTC, Asaf Gery
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Asaf Gery 2012-01-11 19:41:40 UTC
Created attachment 298669 [details]
.abcde.conf with lame configured to create VBR mp3

I recently used abcde, which was built with id3 use flag.
To my surprise the console was filled with stack traces complaining that id3v2 crashes due to stack smashing.
abcde calls id3v2 to tag its mp3 files and id3v2 in turn uses id3lib.
I configured abcde to use variable bit rate.
My make.conf has --stack-protector in its CFLAGS and CXXFLAGS.

Bellow is the output (partial) of abcde:

asaf@squirrel /tmp/abcde_tmp $ abcde
Grabbing entire CD - tracks: 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21
abcde: attempting to resume from /tmp/abcde_tmp/abcde.420eb815..
No CDDB match.
---- Unknown Artist / Unknown Album ----
1: Track 1
2: Track 2
3: Track 3
4: Track 4
5: Track 5
6: Track 6
7: Track 7
8: Track 8
9: Track 9
10: Track 10
11: Track 11
12: Track 12
13: Track 13
14: Track 14
15: Track 15
16: Track 16
17: Track 17
18: Track 18
19: Track 19
20: Track 20
21: Track 21

Edit selected CDDB data? [y/n] (n): 
Is the CD multi-artist? [y/n] (n): 
Grabbing track 01: Track 1...
cdparanoia III release 10.2 (September 11, 2008)

Ripping from sector       0 (track  1 [0:00.00])
          to sector   23409 (track  1 [5:12.09])

outputting to /tmp/abcde_tmp/abcde.420eb815/track01.wav

 (== PROGRESS == [                              | 023409 00 ] == :^D * ==)   

Done.


Grabbing track 02: Track 2...
cdparanoia III release 10.2 (September 11, 2008)

Ripping from sector   23410 (track  2 [0:00.00])
          to sector   35950 (track  2 [2:47.15])

outputting to /tmp/abcde_tmp/abcde.420eb815/track02.wav

 (== PROGRESS == [                   >          | 030531 00 ] == :-) 0 ==)   *** stack smashing detected ***: id3v2 terminated
======= Backtrace: =========
/lib64/libc.so.6(__fortify_fail+0x37)[0x7fb1c3b95ba3]
/lib64/libc.so.6(__fortify_fail+0x0)[0x7fb1c3b95b6c]
/usr/lib64/libid3-3.8.so.3(_ZN7Mp3Info5ParseER10ID3_Readerm+0x790)[0x7fb1c436c422]
/usr/lib64/libid3-3.8.so.3(_ZN11ID3_TagImpl11ParseReaderER10ID3_Reader+0x4d3)[0x7fb1c4370685]
/usr/lib64/libid3-3.8.so.3(_ZN11ID3_TagImpl9ParseFileEv+0x165)[0x7fb1c4370c7d]
/usr/lib64/libid3-3.8.so.3(_ZN11ID3_TagImpl4LinkEPKct+0x3a)[0x7fb1c436d072]
id3v2[0x405d3a]
/lib64/libc.so.6(__libc_start_main+0xec)[0x7fb1c3ad2040]
id3v2[0x401ff9]
======= Memory map: ========
00400000-0040b000 r-xp 00000000 fe:03 825167                             /usr/bin/id3v2
0060a000-0060b000 r--p 0000a000 fe:03 825167                             /usr/bin/id3v2
0060b000-0060d000 rw-p 0000b000 fe:03 825167                             /usr/bin/id3v2
0135f000-01380000 rw-p 00000000 00:00 0                                  [heap]
7fb1c3618000-7fb1c3698000 r-xp 00000000 08:07 77595                      /lib64/libm-2.13.so
7fb1c3698000-7fb1c3897000 ---p 00080000 08:07 77595                      /lib64/libm-2.13.so
7fb1c3897000-7fb1c3898000 r--p 0007f000 08:07 77595                      /lib64/libm-2.13.so
7fb1c3898000-7fb1c3899000 rw-p 00080000 08:07 77595                      /lib64/libm-2.13.so
7fb1c3899000-7fb1c38af000 r-xp 00000000 08:07 74055                      /lib64/libz.so.1.2.5
7fb1c38af000-7fb1c3aae000 ---p 00016000 08:07 74055                      /lib64/libz.so.1.2.5
7fb1c3aae000-7fb1c3aaf000 r--p 00015000 08:07 74055                      /lib64/libz.so.1.2.5
7fb1c3aaf000-7fb1c3ab0000 rw-p 00016000 08:07 74055                      /lib64/libz.so.1.2.5
7fb1c3ab0000-7fb1c3c28000 r-xp 00000000 08:07 77580                      /lib64/libc-2.13.so
7fb1c3c28000-7fb1c3e27000 ---p 00178000 08:07 77580                      /lib64/libc-2.13.so
7fb1c3e27000-7fb1c3e2b000 r--p 00177000 08:07 77580                      /lib64/libc-2.13.so
7fb1c3e2b000-7fb1c3e2c000 rw-p 0017b000 08:07 77580                      /lib64/libc-2.13.so
7fb1c3e2c000-7fb1c3e31000 rw-p 00000000 00:00 0 
7fb1c3e31000-7fb1c3e45000 r-xp 00000000 08:07 77572                      /lib64/libgcc_s.so.1
7fb1c3e45000-7fb1c4045000 ---p 00014000 08:07 77572                      /lib64/libgcc_s.so.1
7fb1c4045000-7fb1c4046000 r--p 00014000 08:07 77572                      /lib64/libgcc_s.so.1
7fb1c4046000-7fb1c4047000 rw-p 00015000 08:07 77572                      /lib64/libgcc_s.so.1
7fb1c4047000-7fb1c412b000 r-xp 00000000 fe:03 939520                     /usr/lib64/gcc/x86_64-pc-linux-gnu/4.5.3/libstdc++.so.6.0.14
7fb1c412b000-7fb1c432a000 ---p 000e4000 fe:03 939520                     /usr/lib64/gcc/x86_64-pc-linux-gnu/4.5.3/libstdc++.so.6.0.14
7fb1c432a000-7fb1c4332000 r--p 000e3000 fe:03 939520                     /usr/lib64/gcc/x86_64-pc-linux-gnu/4.5.3/libstdc++.so.6.0.14
7fb1c4332000-7fb1c4334000 rw-p 000eb000 fe:03 939520                     /usr/lib64/gcc/x86_64-pc-linux-gnu/4.5.3/libstdc++.so.6.0.14
7fb1c4334000-7fb1c4349000 rw-p 00000000 00:00 0 
7fb1c4349000-7fb1c4382000 r-xp 00000000 fe:03 230                        /usr/lib64/libid3-3.8.so.3.0.0
7fb1c4382000-7fb1c4581000 ---p 00039000 fe:03 230                        /usr/lib64/libid3-3.8.so.3.0.0
7fb1c4581000-7fb1c4583000 r--p 00038000 fe:03 230                        /usr/lib64/libid3-3.8.so.3.0.0
7fb1c4583000-7fb1c4585000 rw-p 0003a000 fe:03 230                        /usr/lib64/libid3-3.8.so.3.0.0
7fb1c4585000-7fb1c45a4000 r-xp 00000000 08:07 77589                      /lib64/ld-2.13.so
7fb1c4762000-7fb1c4768000 rw-p 00000000 00:00 0 
7fb1c47a2000-7fb1c47a3000 rw-p 00000000 00:00 0 
7fb1c47a3000-7fb1c47a4000 r--p 0001e000 08:07 77589                      /lib64/ld-2.13.so
7fb1c47a4000-7fb1c47a5000 rw-p 0001f000 08:07 77589                      /lib64/ld-2.13.so
7fb1c47a5000-7fb1c47a6000 rw-p 00000000 00:00 0 
7fffc06e7000-7fffc0709000 rw-p 00000000 00:00 0                          [stack]
7fffc07ff000-7fffc0800000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
/usr/bin/abcde: line 248: 25647 Aborted                 "$@" > /dev/null 2>&1
 (== PROGRESS == [                         >    | 032897 00 ] == :-) o ==)   ^C

Upon searching the web, I found that problem lies in id3lib.
See the following bug report for Ubuntu the patch proposed there:
https://bugs.launchpad.net/ubuntu/+source/id3lib3.8.3/+bug/444466

I patched my ebuild and the problem was solved.

Steps to reproduce:
1. add --stack-protector to CFLAGS and CXXFLAGS
2. build id3lib-3.8.3
3. use the attached .abcde.conf or the following line in .abcde.conf, which    tells lame to create mp3 with variable bit rate:
LAMEOPTS="-q 0 -V 0"
4. run abcde with a music CD inserted in the CD-ROM drive

I created a patch and ebuild, I will attach separately since I don't want to attach a tar file.
Comment 1 Asaf Gery 2012-01-11 20:00:11 UTC
Created attachment 298671 [details, diff]
id3lib-3.8.3-vbr-overflow.patch

with VBR_HEADER_MAX_SIZE = 116, the buffer
char vbrheaderdata[VBR_HEADER_MAX_SIZE+1]
is too small, below it is used with the following variable:
      int vbr_header_size = VBR_HEADER_MIN_SIZE
                           + ((vbr_flags & FRAMES_FLAG)? 4:0)
                           + ((vbr_flags & BYTES_FLAG)? 4:0)
                           + ((vbr_flags & TOC_FLAG)? 100:0)
                           + ((vbr_flags & SCALE_FLAG)? 4:0);
which is 120 in the maximum case. So the patch fixes it to 120 instead of 116 bytes.
(Copied and pasted from https://bugs.launchpad.net/ubuntu/+source/id3lib3.8.3/+bug/444466)
Comment 2 Asaf Gery 2012-01-11 20:01:22 UTC
Created attachment 298673 [details]
id3lib-3.8.3-r9.ebuild

A new ebuild that applies the patch
Comment 3 Asaf Gery 2012-01-11 20:03:50 UTC
I don't think emerge --info is needed in this case, but here it is:
---
asaf@squirrel ~/Music/Chasidik $ emerge --info
Portage 2.1.10.41 (default/linux/amd64/10.0/desktop, gcc-4.5.3, glibc-2.13-r4, 3.1.6-gentoo x86_64)
=================================================================
System uname: Linux-3.1.6-gentoo-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T7500_@_2.20GHz-with-gentoo-2.0.3
Timestamp of tree: Sun, 08 Jan 2012 06:00:01 +0000
app-shells/bash:          4.1_p9
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.2-r3, 3.1.4-r3
dev-util/cmake:           2.8.6-r4
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.9.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13::<unknown repository>, 2.68
sys-devel/automake:       1.5-r1, 1.7.9-r2, 1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.5.3-r1
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 2.6.39 (virtual/os-headers)
sys-libs/glibc:           2.13-r4
Repositories: gentoo java-overlay
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA dlj-1.1 skype-eula PUEL AdobeFlash-10.1 Oracle-BCLA-JavaSE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe --stack-protector"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo"
CXXFLAGS="-march=nocona -O2 -pipe --stack-protector"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://mirror.hamakor.org.il/pub/mirrors/gentoo/ http://ftp.uni-erlangen.de/pub/mirrors/gentoo http://gentoo.tiscali.nl/ http://mirror.muntinternet.net/pub/gentoo/ http://mirror.ovh.net/gentoo-distfiles/ http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ http://mirror.jamit.de/gentoo/ http://ftp.snt.utwente.nl/pub/os/linux/gentoo http://ftp.first-world.info/ http://mirror.cambrium.nl/pub/os/linux/gentoo/"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en he ar tr ru de"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/java-overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac aalib acl acpi alsa amd64 bash-completion berkdb bidi bluetooth branding bzip2 cairo cdda cddb cdr cli consolekit cracklib crypt cups curl cxx dbus dri dts dvd dvdr emboss encode exif extensions extras fam fbcon fbcondecor firefox flac fortran gdbm gdu gif gpm gtk hddtemp iconv icu ieee1394 ipv6 java jpeg kde laptop lcms ldap libnotify lm_sensors mad mmx mng modules mp3 mp4 mpeg mplayer mudflap mule multilib mysql ncurses nls nptl nptlonly nsplugin ogg opengl openmp pam pango pcre pdf png policykit ppds pppd qt3support qt4 readline sdl semantic-desktop session sndfile spell sse sse2 ssl startup-notification svg sysfs tcpd threads tiff truetype udev unicode usb vdpau vorbis x264 xcb xemacs xml xorg xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en he ar tr ru de" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel nvidia virtualbox" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
---
Comment 4 Alex 2015-06-17 08:51:09 UTC
Hi!

Why this well-known bug (p.e. http://www.redhat.com/archives/fedora-extras-commits/2009-November/msg04035.html) is still UNCONFIRMED? Why in June 2015 have updated portage tree i got "stack smashing detected"??? Why it is not in the main portage tree???

Alex
Comment 5 Peter Ulrich 2015-10-14 19:26:19 UTC
Same problem here. Affects also: id3info, kid3 (both stack smashing)

Reproduce:
lame -v /usr/share/sounds/alsa/Noise.wav vbr.mp3
id3info vbr.mp3

See also:
Allegedly fixed in 3.8.3 according to https://bugs.launchpad.net/ubuntu/+source/id3lib3.8.3/+bug/444466

Output:
*** stack smashing detected ***: id3info terminated
======= Backtrace: =========
/lib/libc.so.6(+0x69d79)[0xb74bad79]
/lib/libc.so.6(__fortify_fail+0x37)[0xb754a637]
/lib/libc.so.6(+0xf95fa)[0xb754a5fa]
/usr/lib/libid3-3.8.so.3(_fini+0x0)[0xb773d524]
/usr/lib/libid3-3.8.so.3(_ZN7Mp3Info5ParseER10ID3_Readerj+0xa60)[0xb7730e70]
/usr/lib/libid3-3.8.so.3(_ZN11ID3_TagImpl11ParseReaderER10ID3_Reader+0x438)[0xb7736198]
/usr/lib/libid3-3.8.so.3(_ZN11ID3_TagImpl9ParseFileEv+0x182)[0xb77367c2]
/usr/lib/libid3-3.8.so.3(_ZN11ID3_TagImpl4LinkEPKct+0x47)[0xb7732217]
/usr/lib/libid3-3.8.so.3(_ZN7ID3_Tag4LinkEPKct+0x25)[0xb7731455]
id3info[0x8049573]
/lib/libc.so.6(__libc_start_main+0xde)[0xb7468dde]
id3info[0x80498d0]
======= Memory map: ========
08048000-0804d000 r-xp 00000000 08:07 23527917   /usr/bin/id3info
0804d000-0804e000 r--p 00004000 08:07 23527917   /usr/bin/id3info
0804e000-0804f000 rw-p 00005000 08:07 23527917   /usr/bin/id3info
0804f000-08070000 rw-p 00000000 00:00 0          [heap]
b73ec000-b73ee000 rw-p 00000000 00:00 0 
b73ee000-b7437000 r-xp 00000000 08:07 2738377    /lib/libm-2.20.so
b7437000-b7438000 r--p 00048000 08:07 2738377    /lib/libm-2.20.so
b7438000-b7439000 rw-p 00049000 08:07 2738377    /lib/libm-2.20.so
b7439000-b744e000 r-xp 00000000 08:07 198155     /lib/libz.so.1.2.8
b744e000-b744f000 r--p 00014000 08:07 198155     /lib/libz.so.1.2.8
b744f000-b7450000 rw-p 00015000 08:07 198155     /lib/libz.so.1.2.8
b7450000-b7451000 rw-p 00000000 00:00 0 
b7451000-b75f8000 r-xp 00000000 08:07 2738802    /lib/libc-2.20.so
b75f8000-b75fb000 r--p 001a6000 08:07 2738802    /lib/libc-2.20.so
b75fb000-b75fd000 rw-p 001a9000 08:07 2738802    /lib/libc-2.20.so
b75fd000-b75ff000 rw-p 00000000 00:00 0 
b75ff000-b7619000 r-xp 00000000 08:07 22792788   /usr/lib/gcc/i686-pc-linux-gnu/4.9.3/libgcc_s.so.1
b7619000-b761a000 r--p 00019000 08:07 22792788   /usr/lib/gcc/i686-pc-linux-gnu/4.9.3/libgcc_s.so.1
b761a000-b761b000 rw-p 0001a000 08:07 22792788   /usr/lib/gcc/i686-pc-linux-gnu/4.9.3/libgcc_s.so.1
b761b000-b7704000 r-xp 00000000 08:07 22792803   /usr/lib/gcc/i686-pc-linux-gnu/4.9.3/libstdc++.so.6.0.20
b7704000-b7708000 r--p 000e9000 08:07 22792803   /usr/lib/gcc/i686-pc-linux-gnu/4.9.3/libstdc++.so.6.0.20
b7708000-b7709000 rw-p 000ed000 08:07 22792803   /usr/lib/gcc/i686-pc-linux-gnu/4.9.3/libstdc++.so.6.0.20
b7709000-b7710000 rw-p 00000000 00:00 0 
b7710000-b774b000 r-xp 00000000 08:07 23527891   /usr/lib/libid3-3.8.so.3.0.0
b774b000-b774c000 ---p 0003b000 08:07 23527891   /usr/lib/libid3-3.8.so.3.0.0
b774c000-b774d000 r--p 0003b000 08:07 23527891   /usr/lib/libid3-3.8.so.3.0.0
b774d000-b774f000 rw-p 0003c000 08:07 23527891   /usr/lib/libid3-3.8.so.3.0.0
b7772000-b7774000 rw-p 00000000 00:00 0 
b7774000-b7795000 r-xp 00000000 08:07 2738801    /lib/ld-2.20.so
b7795000-b7796000 r--p 00021000 08:07 2738801    /lib/ld-2.20.so
b7796000-b7797000 rw-p 00022000 08:07 2738801    /lib/ld-2.20.so
bfba9000-bfbca000 rw-p 00000000 00:00 0          [stack]
Aborted
Comment 6 Peter Ulrich 2015-10-15 09:01:09 UTC
btw I am not on amd64 but x86
Comment 7 Carlo Manzoni 2016-11-26 11:29:01 UTC
Hi, I can confirm this behaviour of tools using libid3 as their backend (/usr/lib/libid3-3.8.so.3.0.0) i.e. the problem occurs with id3v2 and id3info here.
Comment 8 Thomas 2017-02-04 14:42:30 UTC
Bug and patch confirmed here on x86