Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 646414 - dev-util/ctags - segmentation fault in eStrdup (str=<optimized out>) at main/routines.c:322
Summary: dev-util/ctags - segmentation fault in eStrdup (str=<optimized out>) at main/...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Vim Maintainers
Depends on:
Reported: 2018-02-02 14:15 UTC by Xuefer
Modified: 2018-02-05 16:28 UTC (History)
0 users

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


Note You need to log in before you can comment on or make changes to this bug.
Description Xuefer 2018-02-02 14:15:46 UTC
reproduce with dev-util/ctags-20170704 sys-devel/clang-5.0.1
either with O1 O2 or O3, but not with O0

Reproducible: Always

Steps to Reproduce:
1. set CFLAGS to O1 or O2 or O3, not O0
2. set compiler to clang
3. emerge ctags
4. run: touch a.c; ctags a.c
Actual Results:  
(gdb) r
Starting program: /usr/bin/ctags a.c

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff785f666 in strlen () from /lib64/
(gdb) bt
#0  0x00007ffff785f666 in strlen () from /lib64/
#1  0x00000000004054b3 in eStrdup (str=<optimized out>) at main/routines.c:322
#2  openTagFile () at main/entry.c:411
#3  0x00000000004105bb in batchMakeTags (args=<optimized out>, user=<optimized out>) at main/main.c:462
#4  runMainLoop (args=<optimized out>) at main/main.c:441
#5  main (argc=<optimized out>, argv=0x7fffffffde40) at main/main.c:682
(gdb) fr 1
#1  0x00000000004054b3 in eStrdup (str=<optimized out>) at main/routines.c:322
322             char* result = xMalloc (strlen (str) + 1, char);
(gdb) up
#2  openTagFile () at main/entry.c:411
411            = eStrdup (Option.tagFileName);
(gdb) p Option.tagFileName
$1 = 0x517680 "tags"
(gdb) p strlen(Option.tagFileName)
$2 = 4
(gdb) do
#1  0x00000000004054b3 in eStrdup (str=<optimized out>) at main/routines.c:322
322             char* result = xMalloc (strlen (str) + 1, char);
(gdb) p str
$3 = <optimized out>

Expected Results:  
no SIGSEGV/coredump

Portage 2.3.19 (python 2.7.14-final-0, default/linux/amd64/17.1, gcc-6.4.0, glibc-2.25-r9, 4.14.15-gentoo x86_64)
=================================================================                                                                                                                             System uname: Linux-4.14.15-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E3-1230_V2_@_3.30GHz-with-gentoo-2.4.1
KiB Mem:     8143872 total,    110960 free
KiB Swap:   15353832 total,  15353832 free
Timestamp of repository gentoo: Sun, 28 Jan 2018 02:45:01 +0000
Head commit of repository gentoo: aaad91ed7cc052c556eb2b097a89659dc67e0f62
sh bash 4.4_p12
ld GNU ld (Gentoo 2.29.1 p3) 2.29.1
ccache version 3.2.4 [enabled]
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r3::gentoo                                                                                                                                                    dev-lang/perl:            5.24.3::gentoo
dev-lang/python:          2.7.14-r1::gentoo, 3.5.4-r1::gentoo, 3.6.3-r1::gentoo
dev-util/ccache:          3.2.4::gentoo                                                                                                                                                       dev-util/cmake:           3.9.6::gentoo                                                                                                                                                       dev-util/pkgconfig:       0.29.2::gentoo                                                                                                                                                      sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/openrc:          0.34.11::gentoo                                                                                                                                                     sys-apps/sandbox:         2.12::gentoo                                                                                                                                                        sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo                                                                                                                                       sys-devel/automake:       1.15.1-r1::gentoo                                                                                                                                                   sys-devel/binutils:       2.29.1-r1::gentoo
sys-devel/gcc:            6.4.0-r1::gentoo                                                                                                                                                    sys-devel/gcc-config:     1.8-r1::gentoo                                                                                                                                                      sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers)
sys-libs/glibc:           2.25-r9::gentoo
CFLAGS="-O2 -pipe -pipe -O2 -march=ivybridge -Wno-error=varargs -Wno-error=parentheses-equality -flto=thin"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.3/conf /var/qmail/alias /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.2/ext-active/ /etc/php/cgi-php7.2/ext-active/
/etc/php/cli-php7.2/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -Wno-error=varargs -Wno-error=parentheses-equality -flto=thin"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg ccache config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch prelink-checksums preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--enable-new-dtags -Wl,--sort-common -Wl,-O2 -Wl,--as-needed -flto=thin -fuse-ld=gold"
PORTAGE_RSYNC_EXTRA_OPTS=" --exclude-from=/etc/portage/rsync_excludes --progress"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
USE="# acc acl aiglx alsa amd64 apache ares avi bash-completion berkdb bitmap-fonts bittorrent bzip2 cgi cjk cli crypt cscope curl cxx dbus enscript expat extensions fam fastcgi fbcon fontconfig fpm gba gd gdbm glib gpm i18n iconv idn imap ipv6 javascript jikes jpeg libssh2 maildir modules mp mp3 mpeg multilib multislot mysqli ncurses nds nethack nls nodejs nptl nptlonly nvidia ogg openmp pam patch pcre pdo perlsuid php png python quicktime readline real rrdcgi sdk seccomp sed server silvercity soap sockets spamassassin sqlite ssl subversion suid svg sync-plugin-portage tcpd termcap-compat threads tinfo toolbar transmitter truetype unicode urandom utf-8 utf8 vim-pager vim-syntax webdav-neon win32codecs withsamplescripts wma xattr xcomposite xml xml2
zlib" ABI_X86="64" ALSA_CARDS="ens1371" APACHE2_MODULES="actions alias auth_basic authn_core authn_file authz_core authz_host unixd socache_shmcb autoindex dav dir env expires headers info log_config mime setenvif status" APACHE2_MPMS="event" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes mabm mcx16 mlzcnt msahf popcnt sse4.1 sse4.2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="coreboot efi-64 pc multiboot" INPUT_DEVICES="keyboard mouse joystick" KERNEL="linux" L10N="en-US en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console
presenter-minimizer" LIRC_DEVICES="serial" LLVM_TARGETS="X86 ARM AArch64" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" RUBY_TARGETS="ruby22 ruby23" USERLAND="GNU" VIDEO_CARDS="vmware fbdev vesa vga nvidia" 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"