Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 198759 - dev-libs/gnulib - m4/printf.m4 segfaults when testing for infinite long doubles
Summary: dev-libs/gnulib - m4/printf.m4 segfaults when testing for infinite long doubles
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL: http://git.savannah.gnu.org/cgit/gnul...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-11 00:04 UTC by Jeff Mitchell
Modified: 2014-11-13 02:03 UTC (History)
2 users (show)

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


Attachments
Code that causes the segfault, compiles normally with gcc (bad_code.c,8.07 KB, text/plain)
2007-11-11 00:05 UTC, Jeff Mitchell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Mitchell 2007-11-11 00:04:57 UTC
One of the programs automake runs segfaults during configure.  I've isolated the code and can reproduce the segfault on both x86 and amd64 platforms, with an exit code of 139.  Occurs on line 202 of the attached bad_code.c.  Running gcc 4.1.2 on x86 and 4.1.1-r3 on amd64, both stable.

Reproducible: Always

Steps to Reproduce:
1.Emerge m4
2.
3.

Actual Results:  
During configure phase a segfault gets logged.

Expected Results:  
Configure completes without segfaults.

emerge --info from the amd64 box here first, then the x86 box.  Code from config.log attached as bad_code.c, segfault happens from line 202 according to gdb.

amd64 box:
Portage 2.1.3.16 (default-linux/amd64/2006.0, gcc-4.1.1, glibc-2.6.1-r0, 2.6.22-gentoo-r8 x86_64)
=================================================================
System uname: 2.6.22-gentoo-r8 x86_64 Intel(R) Pentium(R) D CPU 3.00GHz
Timestamp of tree: Sat, 10 Nov 2007 03:00:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p17
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.4.4-r6
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.9-r2
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.22-r2
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig ccache distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="en_US.utf8"
LC_ALL="en_US.utf8"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="7zip X X509 a52 aac aalib acpi aiglx aim alisp alsa amarok amd64 ao apache2 arts asf async audiofile authfile authlib automount avalon bash-completion bcmath bdf berkdb bidi bitmap-fonts bittorrent bonobo branding bzip2 cairo calendar cddb cdparanoia cgi chroot cjk clamav clamd cli commercial contentcache cracklib crypt css ctype cups curl curlwrappers d daap dbus dcc dcraw dga dio directfb disassembler dovecot-sasl dri dts dvd dvdr dvdread ecc eds emacs emboss encode esd ethereal exif expat extraengine extrafilters fam fame fastcgi fat ffmpeg fftw firefox flac fltk font-server fontconfig foomaticdb force-cgi-redirect fortran fpx ftp fuse gd gdbm gif glut gmp gnome gpgme gpm graphviz gs gstreamer gtk gtk2 gtkhtml guile hal hash hdri howl howl-compat hpn iconv icq id3 idea idn ifsession imagemagick imap imlib innodb inode iproute2 ipv6 irc isdnlog jabber java javamail javascript jbig jce jikes jms jmx joystick jpeg jpeg2k json jython kde kdeenablefinal lame largeterminal latex lcms ldap libcaca libedit libg++ libvisual libwww lm_sensors logitech-mouse logrotate lzo lzw lzw-tiff mad mailbox maildir math mbox mcal mdnsresponder-compat memlimit mhash midi mikmod mime mjpeg mmap mng modplug mono motif mouse mozilla mozsvg mp3 mp4live mpeg mpeg2 mplayer msn mule multiuser musepack musicbrainz mysql mysqli ncurses nethack netpbm network new-login nfs nis nls nocardbus nptl nptlonly nsplugin ntfs nvidia nxclient offensive ogg oggvorbis on-the-fly-crypt openexr opengl openmp openntpd openssh oss pam pango passwordsave paste64 pcntl pcre pear pear-db perl php plotutils pmu png pop3d posix postfix ppds pppd pulseaudio python qt3 qt3support qt4 quicktime rdesktop readline reflection reiserfs restrict rewrite rhino rt2500pci ruby samba sasl script sdl sensord session shaper sharedext sharedmem shorten sieve simplexml sitemisc slang slp smime sndfile soap sockets socks5 softquota spamassassin speex spell spl sql sqlite sqlite3 ssl streamzap svg svgz sysfs syslog sysvipc tcl tcltk tcpd theora threads tiff tk tokenizer tools transcode truetype truetype-fonts type1 type1-fonts ucs2 unicode unzip usb utempter utf8 utils v4l v4l2 vcd vda vfat vhosts vim-syntax visualization vorbis vroot webdav wma wmf wordperfect wv wxwindows xcb xemacs xface xforms xfs xinerama xinetd xml xmlreader xmlrpc xmlwriter xorg xosd xpm xprint xrandr xscreensaver xsl xslt xv xvid xvmc yahoo zeroconf zip zlib" ALSA_CARDS="usb-audio" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="nv fbdev nvidia"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS


x86 box:
Portage 2.1.3.19 (default-linux/x86/2007.0/desktop, gcc-4.1.2, glibc-2.6.1-r0, 2.6.21-suspend2-r6 i686)
=================================================================
System uname: 2.6.21-suspend2-r6 i686 Intel(R) Pentium(R) M processor 1700MHz
Timestamp of tree: Sat, 10 Nov 2007 02:46:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p17
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.4.4-r6
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.9-r2
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.22-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium-m -O2 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-march=pentium-m -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache collision-protect distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://gentoo.osuosl.org/"
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LINGUAS="en en_US"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="16bit 4kstacks 7zip X X509 a52 aac aalib acl acpi activefilter ada addbookmarks aiglx aim alias alsa amazon amr amuled ao aoss apache2 asf asm async audiofile autoipd automount autoreplace avahi bash-completion berkdb bitmap-fonts bluetooth bonjour bonobo bookmarks branding browserplugin bzip2 bzlib cairo calendar cardbus ccache cdda cddb cdio cdparanoia cdr cdrom cgi chm clearcase cli codecs commercial connectionstatus contactnotes cpudetection cracklib crypt css ctype cups curl curlwrappers cvs daap dbus dell dga dhcp dio disk-partition divx divx4linux djvu dmi dnd dri dtaus dts dv dvb dvd dvdr dvdread eap-tls emacs emboss emerald emf enca encode esd evo2 exif expat exscalibar extensions extrafilters fam fame fastcgi fb fbdev ffmpeg fftw firefox flac fltk font-server fontconfig foomaticdb force-cgi-redirect fortran fpx freetype ftp fuse gadu galago gd gdbm gecko-sdk geoip gg gif gimp gimpprint glitz gmail gmailtimestamps gmedia gmp gnokii gnome gnome-print gphoto2 gpm graphviz groupwise gs gsm gstreamer gtk gtk2 gtkhtml h323 hal hash haskell hbci hdri highlight history howl-compat hpn httpd ical iconv icq icu id3 idn ieee1394 imagemagick imap inifile inkjar iproute2 ipv6 irc irda irman irmc jabber jack java javascript jbig jce jikes jit joystick jpeg jpeg2k json justify kde kdeenablefinal kdepim kdrive kerberos kipi kqemu krb4 lame largeterminal latex lcms ldap libcaca libnotify libsamplerate lirc live lm_sensors logitech-mouse logrotate lua lzo lzw mad maildir matroska mbox md5sum mdnsresponder-compat memlimit menubar mhash midi mikmod mime mjpeg mmap mmx mmxext mng modplug mono motif mozbranding mozilla mozsvg mozxmlterm mp3 mp4 mp4live mpeg mpeg2 mplayer msn multiuser musepack musicbrainz mysql mysqli nas ncurses neXt nethack netjack netpbm network network-cron new-login newspr nls nntp nowlistening nptl nptlonly nsplugin ntlm numeric nv nvidia nxclient offensive ofx ogg ole on-the-fly-crypt openal openexr opengl openmp openssl oscar oss pam pam_console pam_timestamp pango pascal passwordsave paste64 pch pcre pdf perforce perl pertty php player plotutils plugin pmu png pnp portaudio posix postfix postgres postscript povray ppds pppd prediction profile ps python qemu-fast qt3 qt3support qt4 quicktime quotes rar rdesktop readline real realmedia reflection reiserfs remote rle rrdtool rss rtsp ruby samba sametime sasl scanner screen screenshot sdl sensord server session sharedext shorten shout simplexml skey slang slp smime sms sndfile soap sockets socks5 sound soundex speedo speex spell spl sql sqlite sqlite3 sse sse2 ssl startup-notification statistics stats stream subversion svg svga sysfs sysvipc tcl tcltk tcpd texteffect theora threads tidy tiff timidity tk tokenizer toolbar transcode translator transparency truetype truetype-fonts type1 type1-fonts ucs2 unicode usb userlocales utempter utf8 v4l v4l2 vcd vesa vidix vim vim-pager vim-syntax vim-with-x visualization vlm vnc vorbis vorbis-psy wavpack webdav webpresence wifi win32codecs winpopup wma wmf wmp wxgtk1 wxwindows x264 x86 xanim xattr xcb xchatnogtk xchattext xcomposite xerces-c xext xface xforms xft xine xinerama xkb xml xmlreader xmlrpc xmlwriter xorg xosd xpm xprint xrandr xscreensaver xsl xv xvid xvmc yahoo yaz yv12 zephyr zeroconf zip zlib zvbi" ALSA_CARDS="intel8x0" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" CAMERAS="canon directory spca50x ptp2" ELIBC="glibc" INPUT_DEVICES="evdev joystick keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_US" USERLAND="GNU" VIDEO_CARDS="nvidia fbdev vesa nv v4l"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Jeff Mitchell 2007-11-11 00:05:34 UTC
Created attachment 135699 [details]
Code that causes the segfault, compiles normally with gcc
Comment 2 Marius Capmare 2007-11-11 11:11:07 UTC
Stack overflow on 'buf'.

The conversion of the number to a long float causes the string representation of the number to keep all the leading 0s, and since we're dealing with a long float there's quite a few of them (4923 to be specific). 'buf' only gets 100 bytes allocated. The output of the conversion to string form is 4931 characters/bytes.

It may not be the code's fault. It may be libc's fault for keeping the leading 0s for a conversion that doesn't specify the number of digits to be shown.
Comment 3 Stefan Hellermann 2008-02-28 14:52:59 UTC
I found this mail with a small patch, but I haven't tested it yet.
http://www.mail-archive.com/bug-m4@gnu.org/msg02248.html
Comment 4 SpanKY gentoo-dev 2014-11-13 02:03:28 UTC
the versions in question have been cycled out now, so i don't think there's anything left to do here

http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=99e382038a886fc0e7f38a76f465f5662cb34f62