Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 607094 - =dev-libs/libxls-0.3.0_pre107 leaks memory on certain .xls files
Summary: =dev-libs/libxls-0.3.0_pre107 leaks memory on certain .xls files
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal critical (vote)
Assignee: Sergei Trofimovich (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-24 17:14 UTC by globus
Modified: 2017-01-29 14:09 UTC (History)
0 users

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


Attachments
example (npsp.xls,158.00 KB, application/octet-stream)
2017-01-26 03:25 UTC, globus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description globus 2017-01-24 17:14:41 UTC
When viewed in mc (Midnight Commander) files *.xls, high load system & large memory consumption. As well as in the window messages mc ~="error decoding UTF-16", when you see Russian text.

Reproducible: Always

Steps to Reproduce:
1. emerge dev-libs/libxls
2. Run mc 
3. Find the file *.xls and open it using F3
Actual Results:  
The system slows down, increasing load average, increasing memory consumption, increasing swap, close some programs.

Expected Results:  
In the mc window should open *.xls

aspera ~ # emerge --info
Portage 2.3.0 (python 2.7.12-final-0, default/linux/amd64/13.0/desktop, gcc-4.9.4, glibc-2.23-r3, 4.4.39-gentoo-m1 x86_64)
=================================================================
System uname: Linux-4.4.39-gentoo-m1-x86_64-AMD_Athlon-tm-_II_X2_250e_Processor-with-gentoo-2.3
KiB Mem:     4048600 total,   2969696 free
KiB Swap:   10485692 total,  10168928 free
Timestamp of repository gentoo: Sun, 22 Jan 2017 16:00:01 +0000
sh bash 4.3_p48-r1
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p48-r1::gentoo
dev-lang/perl:            5.22.3_rc4::gentoo
dev-lang/python:          2.7.12::gentoo, 3.4.5::gentoo
dev-util/cmake:           3.6.3::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.22.4::gentoo
sys-apps/sandbox:         2.10-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.9.4::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r3::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=native -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going=y --quiet-build=y --with-bdeps=y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://trumpetti.atm.tut.fi/gentoo/"
LANG="ru_RU.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_BUNZIP2_COMMAND="lbunzip2 -n2"
PORTAGE_BZIP2_COMMAND="lbzip2 -n2"
PORTAGE_CONFIGROOT="/"
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"
PORTAGE_TMPDIR="/var/tmp"
USE="3dnow 3dnowext X a52 aac acpi alsa amd64 bash-completion berkdb bindist branding bzip2 cairo cdda cdr cli cracklib crypt cuda cxx dbus dri drm dts dvd dvdr egl encode exif fam firefox flac gdbm gif glamor gtk iconv jpeg jpeg2k ladspa lcms libnotify mad mmx mmxext mng modules mp3 mp4 mpeg mtp multilib musepack ncurses nls nptl nvidia ogg opengl openmp pam pango pcre pdf png popcnt ppds readline sdl seccomp session smp sse sse2 sse3 sse4a ssl startup-notification svg tcpd tiff truetype udev unicode upower usb vaapi vdpau vorbis wmf wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_X86="64" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd 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 sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="3dnow 3dnowext mmx mmxext popcnt sse sse2 sse3 sse4a" 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 ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" L10N="ru en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="ru en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby21" USERLAND="GNU" VIDEO_CARDS="nvidia vesa" 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:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 globus 2017-01-24 17:19:01 UTC
The file *.xls needs to be quite large, about 200 KB, small open without consequences.
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2017-01-25 20:55:17 UTC
Can you attach an example file that exhibits a problem?
Comment 3 globus 2017-01-26 03:25:16 UTC
Created attachment 461454 [details]
example
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2017-01-28 17:26:44 UTC
Yeah, it's an xls2csv bug.

'xls2csv npsp.xls' run takes 25GB on my machine.
valgrind is full of out-of-bounds reports.
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2017-01-28 18:09:11 UTC
I've pushed libxls-1.4.0 as (gitweb is currently down):
    https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=62ae86ae23409ba8729e545e7e5034962cd9ca1c

New version does not decode your file properly yet.
But at least it does not go out of bounds instantly,
manages to render some russian strings and fits into
1GB RAM in an indefinite loop :)
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2017-01-28 20:37:49 UTC
I think I've nailed down the infinite loop
with this commit:
    https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4bbc0bd925e32087de9c61bf2bee81d00ec1ad7f

With dev-libs/libxls-1.4.0-r1 file view finishes in seconds.
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2017-01-29 14:09:07 UTC
Reported both patches upstream as:
    https://sourceforge.net/p/libxls/patches/11/
    https://sourceforge.net/p/libxls/patches/12/