Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 817395 - games-emulation/zsnes-1.51-r11 - *** buffer overflow detected ***: terminated
Summary: games-emulation/zsnes-1.51-r11 - *** buffer overflow detected ***: terminated
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-10 17:22 UTC by Fab
Modified: 2021-12-22 18:15 UTC (History)
3 users (show)

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


Attachments
zsnes-1.51-r11 build log (zsnes-1.51-r11:20211009-140441.log,103.07 KB, text/plain)
2021-10-10 17:22 UTC, Fab
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fab 2021-10-10 17:22:25 UTC
Created attachment 744339 [details]
zsnes-1.51-r11 build log

Hi,

When trying to load a ROM into ZSNES, it fails with :
> *** buffer overflow detected ***: terminated
> Abandon
Comment 1 Fab 2021-10-10 17:22:45 UTC
$ emerge --info
Portage 3.0.20 (python 3.9.6-final-0, default/linux/amd64/17.1/desktop, gcc-10.3.0, glibc-2.33-r1, 5.10.61-gentoo x86_64)
=================================================================
System uname: Linux-5.10.61-gentoo-x86_64-Intel-R-_Core-TM-_i5-2500K_CPU_@_3.30GHz-with-glibc2.33
KiB Mem:    16362984 total,   4698984 free
KiB Swap:   18874356 total,  18872804 free
Timestamp of repository gentoo: Thu, 07 Oct 2021 12:51:28 +0000
Head commit of repository gentoo: 84dc46a364ac4d571208765578bc3aa91547b978

Head commit of repository guru: 4e71e1e1991456a55be491a1437cce655c00f694

Head commit of repository steam-overlay: d90ce0627d7c30027f4971dce6f67f22abd71e6d

Head commit of repository netfab-overlay: ecd5dacb2abd3065af62b506dcda89436221d08f

sh bash 5.1_p8
ld GNU ld (Gentoo 2.37_p1 p0) 2.37
distcc 3.4 x86_64-pc-linux-gnu [disabled]
app-shells/bash:          5.1_p8::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.34.0-r2::gentoo
dev-lang/python:          2.7.18_p13::gentoo, 3.8.12::gentoo, 3.9.6_p2::gentoo
dev-lang/rust-bin:        1.53.0::gentoo
dev-util/cmake:           3.20.5::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.43.5::gentoo
sys-apps/sandbox:         2.24::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.71-r1::gentoo
sys-devel/automake:       1.13.4-r2::gentoo, 1.16.4::gentoo
sys-devel/binutils:       2.37_p1::gentoo
sys-devel/gcc:            10.3.0-r2::gentoo
sys-devel/gcc-config:     2.4::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.33-r1::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://anongit.gentoo.org/git/repo/sync/gentoo.git
    priority: -1000

guru
    location: /var/db/repos/guru
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/guru.git
    masters: gentoo

steam-overlay
    location: /var/db/repos/steam-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/steam-overlay.git
    masters: gentoo

netfab-overlay
    location: /var/db/repos/netfab-overlay
    sync-type: git
    sync-uri: git://github.com/netfab/overlay.git
    masters: gentoo
    priority: 9999

Installed sets: @common-apps, @dev-apps, @games-apps, @portage-apps, @system-apps, @xfce
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -mmmx -msse -msse2 -msse3 -mssse3 -mcx16 -msahf -mpclmul -mpopcnt -msse4.2 -msse4.1 -mfxsr -fstack-protector-strong -mno-3dnow -mno-sse4a -mno-movbe -mno-aes -mno-sha -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-sgx -mno-bmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mno-avx -mno-avx2 -mno-lzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mno-prfchw -mno-adx -mno-xsave -mno-xsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mno-clflushopt -mno-xsavec -mno-xsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mno-mwaitx -mno-clzero -mno-pku -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b -mno-waitpkg -mno-cldemote -mno-ptwrite"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /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"
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -mmmx -msse -msse2 -msse3 -mssse3 -mcx16 -msahf -mpclmul -mpopcnt -msse4.2 -msse4.1 -mfxsr -fstack-protector-strong -mno-3dnow -mno-sse4a -mno-movbe -mno-aes -mno-sha -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-sgx -mno-bmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mno-avx -mno-avx2 -mno-lzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mno-prfchw -mno-adx -mno-xsave -mno-xsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mno-clflushopt -mno-xsavec -mno-xsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mno-mwaitx -mno-clzero -mno-pku -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b -mno-waitpkg -mno-cldemote -mno-ptwrite"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask=y --with-bdeps=y --jobs 3 --load-average 3 --keep-going"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -mmmx -msse -msse2 -msse3 -mssse3 -mcx16 -msahf -mpclmul -mpopcnt -msse4.2 -msse4.1 -mfxsr -fstack-protector-strong -mno-3dnow -mno-sse4a -mno-movbe -mno-aes -mno-sha -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-sgx -mno-bmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mno-avx -mno-avx2 -mno-lzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mno-prfchw -mno-adx -mno-xsave -mno-xsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mno-clflushopt -mno-xsavec -mno-xsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mno-mwaitx -mno-clzero -mno-pku -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b -mno-waitpkg -mno-cldemote -mno-ptwrite"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg clean-logs config-protect-if-modified distlocks ebuild-locks fail-clean fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-log strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -mmmx -msse -msse2 -msse3 -mssse3 -mcx16 -msahf -mpclmul -mpopcnt -msse4.2 -msse4.1 -mfxsr -fstack-protector-strong -mno-3dnow -mno-sse4a -mno-movbe -mno-aes -mno-sha -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-sgx -mno-bmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mno-avx -mno-avx2 -mno-lzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mno-prfchw -mno-adx -mno-xsave -mno-xsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mno-clflushopt -mno-xsavec -mno-xsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mno-mwaitx -mno-clzero -mno-pku -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b -mno-waitpkg -mno-cldemote -mno-ptwrite"
GENTOO_MIRRORS=" ftp://ftp.free.fr/mirrors/ftp.gentoo.org/ http://ftp.free.fr/mirrors/ftp.gentoo.org/ http://gentoo.mirrors.ovh.net/gentoo-distfiles/ https://mirrors.soeasyto.com/distfiles.gentoo.org/ http://mirrors.soeasyto.com/distfiles.gentoo.org/ ftp://mirrors.soeasyto.com/distfiles.gentoo.org/ "
LANG="fr_FR.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j9"
PKGDIR="/var/cache/binpkgs"
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="X a52 aac acl acpi alsa amd64 bluetooth branding bzip2 cairo cdda cdr cli crypt cups dbus dri dts dvd dvdr elogind emboss encode exif ffmpeg flac fortran gdbm gif gnutls gstreamer gtk gtk3 gui hddtemp iconv icu id3tag ipv6 java jpeg lcms libglvnd libnotify libtirpc lm-sensors mad matroska mng mp3 mp4 mpeg multilib ncurses nls nptl nsplugin ogg opengl openmp pam pango pcre pdf png policykit ppds pulseaudio qt5 readline sdl seccomp sox spell split-usr ssl startup-notification svg tcpd theora tiff truetype udev udisks unicode upower usb v4l vaapi vdpau vorbis wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_X86="64 32" ADA_TARGET="gnat_2019" 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" 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="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en fr" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" QEMU_SOFTMMU_TARGETS="x86_64 i386" QEMU_USER_TARGETS="x86_64 i386" RUBY_TARGETS="ruby26" USERLAND="GNU" VIDEO_CARDS="nouveau nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS
Comment 2 Ionen Wolkens gentoo-dev 2021-10-10 18:35:28 UTC
My personal recommendation would be to use just about any other snes emulators than zsnes (snes9x, mednafen, higan, retroarch from overlays, many other options)

Last official zsnes release is from 2007 and very broken (and a security nightmare), we have many patches to try to resolve this but that has its limits.

Your CFLAGS may possibly not help with its dodgy x86 asm use too.

There is a fork that I'm considering packaging but it's very recent and hasn't seen much activity yet, also I think it has about the same patches we do -- may possibly not run any better for you.
Comment 3 Fab 2021-10-10 19:24:15 UTC
Yes, I will try others emulators.

I already tried the fork from ⁽¹⁾, but it fails on start, not surprising for the moment, let's give them time. I also tried to tweak my CFLAGS without luck (by removing -fstack-protector-strong), but I suppose that this kind of critical flag requires the entire system to be rebuilt.

1. https://github.com/xyproto/zsnes
Comment 4 Jonas Stein gentoo-dev 2021-12-22 01:32:39 UTC
increasing to critical, because zsnes seems to be unmaintained and totally broken. It should not crash per default unless it is hardmasked.

Upstream has several segfault bugs, which remain open since years:
https://sourceforge.net/p/zsnes/bugs/166/ and more.

There is an interesting fork which is packaged by arch and manjaro:
https://github.com/xyproto/zsnes

https://repology.org/project/zsnes/versions
Comment 5 Jonas Stein gentoo-dev 2021-12-22 01:34:05 UTC
*** Bug 829785 has been marked as a duplicate of this bug. ***
Comment 6 Ionen Wolkens gentoo-dev 2021-12-22 09:41:30 UTC
(In reply to Jonas Stein from comment #4)
> increasing to critical, because zsnes seems to be unmaintained and totally
> broken. It should not crash per default unless it is hardmasked.
> 
> Upstream has several segfault bugs, which remain open since years:
> https://sourceforge.net/p/zsnes/bugs/166/ and more.
> 
> There is an interesting fork which is packaged by arch and manjaro:
> https://github.com/xyproto/zsnes
> 
> https://repology.org/project/zsnes/versions

See comment #3

User reports that fork fails all the same so it (probably?) wouldn't help this bug, we also carry 16 patches for these sourceforge issues which mostly amount to the same fixes the fork is doing (perhaps more).

Fork also hasn't seen any real activity since its creation (beside readme changes).

Now that slyfox is no longer working on this, it may be better to just last rite it but I was waiting to see if the fork started doing more improvements.
Comment 7 Ionen Wolkens gentoo-dev 2021-12-22 09:50:50 UTC
(In reply to Ionen Wolkens from comment #6)
> Now that slyfox is no longer working on this, it may be better to just last
> rite it but I was waiting to see if the fork started doing more improvements.
...not to mention ultimately still have to rely on multilib

I'll give the fork a try later in case our patches are doing something wrong, but it doesn't work then I'll go for last rites. I'm under the impression it was working until recently though, given slyfox was still patching it.
Comment 8 Ionen Wolkens gentoo-dev 2021-12-22 11:14:27 UTC
I hadn't looked closely at this bug yet, but looks like a continuation of bug #257963
Comment 9 Ionen Wolkens gentoo-dev 2021-12-22 14:02:59 UTC
I'm actually not able to reproduce this, although fortify is not properly disabled nonetheless (the fork's explicitly passes FORTIFY_SOURCE=0).

Some bits seem messy still, but the fork mostly seem to work.

Will probably add it soon.
Comment 10 Larry the Git Cow gentoo-dev 2021-12-22 18:15:01 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=484cf796cfa38577842783be53a79346b65a8dcf

commit 484cf796cfa38577842783be53a79346b65a8dcf
Author:     Ionen Wolkens <ionen@gentoo.org>
AuthorDate: 2021-12-22 10:53:17 +0000
Commit:     Ionen Wolkens <ionen@gentoo.org>
CommitDate: 2021-12-22 18:12:26 +0000

    games-emulation/zsnes: add 2.0.9 (fork) with new dumbed down ebuild
    
    zsnes is very fragile, and supporting many configurations/flags
    doesn't seem worth it anymore. So this uses current upstream
    defaults for safety (no libao+debugger, and enable sdl+png+opengl).
    
    May possibly have some new issues / regressions to iron out, notably
    given doesn't use autoconf anymore which shifted many things around.
    
    Unsure if this fork will be maintained on the long term, if not
    then this package may be better off last-rited.
    
    bug 817395: fork uses FORTIFY_SOURCE=0 which combined with -U should
                ensure it's unused even if our gcc enables it by default
    (issue does exist still, was able to reproduce if letting it use it)
    bug 829785: cause is unknown but can't reproduce when using the fork
    
    Closes: https://bugs.gentoo.org/817395
    Closes: https://bugs.gentoo.org/829785
    Signed-off-by: Ionen Wolkens <ionen@gentoo.org>

 games-emulation/zsnes/Manifest                     |  1 +
 .../zsnes/files/zsnes-2.0.9-cc-quotes.patch        |  8 +++
 .../zsnes/files/zsnes-2.0.9-gentoo-zlib.patch      | 12 +++++
 games-emulation/zsnes/zsnes-2.0.9.ebuild           | 62 ++++++++++++++++++++++
 4 files changed, 83 insertions(+)