Bug#968375: scottfree: Crashes when restoring save file

2020-08-14 Thread Bernhard Übelacker
Dear Maintainer,
this fault is caused by a wrong format in a call to fscanf.

Attached a patch to fix this and remove two other warnings.

Kind regards,
Bernhard

# Bullseye/testing amd64 qemu VM 2020-08-14


apt update
apt dist-upgrade


apt install systemd-coredump sddm xserver-xorg openbox xterm unzip mc fakeroot 
quilt gdb rr scottfree scottfree-dbgsym
apt build-dep scottfree

echo 1 > /proc/sys/kernel/perf_event_paranoid



mkdir /home/benutzer/source/scottfree/orig -p
cd/home/benutzer/source/scottfree/orig
apt source scottfree
cd


wget 
http://www.ifarchive.org/if-archive/scott-adams/games/scottfree/AdamsGames.zip
unzip AdamsGames.zip -d AdamsGames
cd AdamsGames/



##


export DISPLAY=:0
scottfree adv01.dat


Tell me what to do ? SAVE GAME
OK
Filename: test.sav

Saved.

Tell me what to do ? QUIT
I've stored 0  treasures.  On a scale of 0 to 100, that rates 0 .
The game is now over.



##


$ scottfree adv01.dat test.sav
*** stack smashing detected ***:  terminated
 Abgebrochen (Speicherabzug 
geschrieben)




$ gdb -q --args scottfree adv01.dat test.sav
Reading symbols from scottfree...Reading symbols from 
/usr/lib/debug/.build-id/41/565267f3552c9b645ec125e201ac393874a90f.debug...done.
done.
(gdb) directory /home/benutzer/source/scottfree/orig/scottfree-1.14
Source directories searched: 
/home/benutzer/source/scottfree/orig/scottfree-1.14:$cdir:$cwd
(gdb) run
Starting program: /usr/games/scottfree adv01.dat test.sav
*** stack smashing detected ***:  terminated

 Program received signal 
SIGABRT, Aborted.

  __GI_raise (sig=sig@entry=6) at 
../sysdeps/unix/sysv/linux/raise.c:50
50  ../sysdeps/unix/sysv/linux/raise.c: Datei oder Verzeichnis nicht 
gefunden.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x77dcd535 in __GI_abort () at abort.c:79
#2  0x77e24508 in __libc_message (action=, 
fmt=fmt@entry=0x77f2f07b "*** %s ***: %s terminated\n") at 
../sysdeps/posix/libc_fatal.c:181
#3  0x77eb580d in __GI___fortify_fail_abort 
(need_backtrace=need_backtrace@entry=false, msg=msg@entry=0x77f2f059 "stack 
smashing detected") at fortify_fail.c:28
#4  0x77eb57c2 in __stack_chk_fail () at stack_chk_fail.c:29
#5  0x73e3 in LoadGame (name=) at ScottCurses.c:708
#6  0x5812 in main (argc=3, argv=0x7fffe578) at 
ScottCurses.c:1393
(gdb) up
#1  0x77dcd535 in __GI_abort () at abort.c:79
79  abort.c: Datei oder Verzeichnis nicht gefunden.
(gdb) 
#2  0x77e24508 in __libc_message (action=, 
fmt=fmt@entry=0x77f2f07b "*** %s ***: %s terminated\n") at 
../sysdeps/posix/libc_fatal.c:181
181 ../sysdeps/posix/libc_fatal.c: Datei oder Verzeichnis nicht gefunden.
(gdb) 
#3  0x77eb580d in __GI___fortify_fail_abort 
(need_backtrace=need_backtrace@entry=false, msg=msg@entry=0x77f2f059 "stack 
smashing detected") at fortify_fail.c:28
28  fortify_fail.c: Datei oder Verzeichnis nicht gefunden.
(gdb) 
#4  0x77eb57c2 in __stack_chk_fail () at stack_chk_fail.c:29
29  stack_chk_fail.c: Datei oder Verzeichnis nicht gefunden.
(gdb) 
#5  0x73e3 in LoadGame (name=) at ScottCurses.c:708
warning: Source file is more recent than executable.
708 }




##


$ rr scottfree adv01.dat test.sav
rr: Saving execution to trace directory 
`/home/benutzer/.local/share/rr/scottfree-0'.
*** stack smashing detected ***:  terminated
 Abgebrochen



$ rr replay /home/benutzer/.local/share/rr/scottfree-0
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/games/scottfree...Reading symbols from 
/usr/lib/debug/.build-id/41/565267f3552c9b645ec125e201ac393874a90f.debug...done.
done.
Really redefine built-in command "restart"? (y or n) [answered Y; input not 
from terminal]
Remote debugging using 127.0.0.1:4913
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from 
/usr/lib/debug/.build-id/f2/5dfd7b95be4ba386fd71080accae8c0732b711.debug...done.
done.
0x7f5521117090 in _start () from /li

Bug#968375: scottfree: Crashes when restoring save file

2020-08-13 Thread Colin Williams
Package: scottfree
Version: 1.14-10+b1
Severity: important
Tags: newcomer

Dear Maintainer,


   * What led up to the situation? Attempting to restore any save file with the
command:  scottfree  

   * What exactly did you do (or not do) that was effective (or
 ineffective)? N/A

   * What was the outcome of this action? Program crashed with the message:
*** stack smashing detected ***:  terminated

   * What outcome did you expect instead? To resume a saved adventure.

Fix:  Rebuild the package with DEB_BUILD_OPTIONS="noopt", the program no longer
crashes and works as expected.



-- System Information:
Debian Release: 10.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-10-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages scottfree depends on:
ii  libc62.28-10
ii  libncurses6  6.1+20181013-2+deb10u2
ii  libtinfo66.1+20181013-2+deb10u2

scottfree recommends no packages.

scottfree suggests no packages.

-- no debconf information