Hello,
tried to reproduce this crash in a Stretch amd64 VM.

It wants to open the directory "maps":

benutzer@debian:~$ strace -f zatacka 2>&1 | grep maps
open("maps", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such 
file or directory)

Therefore a null pointer is handed to readdir.

Until 0.1.8-2 this directory got created and the file map1.jpg installed as 
maps1.jpg:

--- 0.1.8-2/zatacka-0.1.8/debian/rules  2018-09-10 18:43:42.000000000 +0200
+++ 0.1.8-3/zatacka-0.1.8/debian/rules  2013-05-02 17:03:14.000000000 +0200
...
-       install -m 0644 maps/map1.jpg 
$(CURDIR)/debian/zatacka/usr/share/zatacka/maps/maps1.jpg

Since 0.1.8-3 the package does not contain the whole directory.
Yet the file map1.jpg is conatined as map1.jpg, but the application
tries to open a directory "maps".

Kind regards,
Bernhard
From 657b33ad80500229998592916a1b371be48b6891 Mon Sep 17 00:00:00 2001
From: Bernhard Übelacker <bernha...@mailbox.org>
Date: Mon, 10 Sep 2018 19:06:55 +0200
Subject: [PATCH] Install maps/maps1.jpg

Debian-Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=891778
---
 Makefile.am | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 45b28ba..2931caa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,10 +10,11 @@ LICENSE
 
 install-data-local:
 	 @$(PRE_INSTALL)
-	 $(mkinstalldirs) $(DESTDIR)$(DEFAULT_LIBDIR)/$(PACKAGE); \
+	 $(mkinstalldirs) $(DESTDIR)$(DEFAULT_LIBDIR)/$(PACKAGE)/maps; \
 	 $(INSTALL_DATA) $(srcdir)/img/main_screen.jpg $(DESTDIR)$(DEFAULT_LIBDIR)/$(PACKAGE); \
 	 $(INSTALL_DATA) $(srcdir)/img/barrier.jpg $(DESTDIR)$(DEFAULT_LIBDIR)/$(PACKAGE); \
 	 $(INSTALL_DATA) $(srcdir)/maps/map1.jpg $(DESTDIR)$(DEFAULT_LIBDIR)/$(PACKAGE);
+	 $(INSTALL_DATA) $(srcdir)/maps/map1.jpg $(DESTDIR)$(DEFAULT_LIBDIR)/$(PACKAGE)/maps/maps1.jpg;
 
 uninstall-local:
 	rm -rf $(DEFAULT_LIBDIR)/zatacka/*
-- 
2.11.0


apt install xserver-xorg sddm openbox xterm mc dpkg-dev devscripts colordiff 
gdb zatacka zatacka-dbgsym libsdl-ttf2.0-0-dbgsym
apt build-dep zatacka

systemctl start sddm


mkdir zatacka/orig -p
cd    zatacka/orig
apt source zatacka
cd ../..


export DISPLAY=:0
$ zatacka 
Speicherzugriffsfehler






benutzer@debian:~$ gdb -q --args zatacka
Reading symbols from zatacka...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/games/zatacka 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6da8a82 in __readdir (dirp=0x0) at ../sysdeps/posix/readdir.c:44
44      ../sysdeps/posix/readdir.c: Datei oder Verzeichnis nicht gefunden.
(gdb) bt
#0  0x00007ffff6da8a82 in __readdir (dirp=0x0) at ../sysdeps/posix/readdir.c:44
#1  0x00005555555575dc in ?? ()
#2  0x0000555555555700 in main ()
(gdb)






benutzer@debian:~$ gdb -q --args zatacka
Reading symbols from zatacka...Reading symbols from 
/usr/lib/debug/.build-id/53/5cb8e1b018c227f6540c2ec464eb78aa5b4c67.debug...done.
done.
(gdb) set height 0
(gdb) set width 0
(gdb) set pagination off
(gdb) directory /home/benutzer/zatacka/orig/zatacka-0.1.8/src
Source directories searched: 
/home/benutzer/zatacka/orig/zatacka-0.1.8/src:$cdir:$cwd
(gdb) run
Starting program: /usr/games/zatacka 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6da8a82 in __readdir (dirp=dirp@entry=0x0) at 
../sysdeps/posix/readdir.c:44
44      ../sysdeps/posix/readdir.c: Datei oder Verzeichnis nicht gefunden.
(gdb) bt
#0  0x00007ffff6da8a82 in __readdir (dirp=dirp@entry=0x0) at 
../sysdeps/posix/readdir.c:44
#1  0x00005555555575dc in menu (screen=0x5555557a8f20) at fx.cpp:425
#2  0x0000555555555700 in main (argc=<optimized out>, argv=<optimized out>) at 
main.cpp:40

(gdb) list menu
293
294     bool menu(SDL_Surface *screen){

306             DIR *dir;

339             dir=opendir("maps"); //open maps directory
340             while(!quit){
341                     SDL_Delay(1);   //don't use 100% cpu
342                     while(SDL_PollEvent(&event)){
343                             switch(event.type){

354                                     case SDL_KEYDOWN:
355                                          if(lineno==0){             //if I 
am not catching keys for some line
356                                             switch(event.key.keysym.sym){   
//I am catching control keys

424                                                     case SDLK_m:
425                                                             if(NULL == 
(dent=readdir(dir))) { //if I am at the end of directory list
426                                                                     
rewinddir(dir); //return to beginning
427                                                                     
strcpy(bgpath,"none"); //in the end of list is none background
428                                                             }else{
429                                                                     
strcpy(bgpath, dent->d_name); //copy directory name to bgpath





benutzer@debian:~$ strace -f zatacka 2>&1 | grep maps
open("maps", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such 
file or directory)





http://snapshot.debian.org/archive/debian/20080316T000000Z/pool/main/z/zatacka/zatacka_0.1.8-2_amd64.deb
/usr/share/games/zatacka/map1.jpg
/usr/share/zatacka/maps/maps1.jpg


http://snapshot.debian.org/archive/debian/20130505T155245Z/pool/main/z/zatacka/zatacka_0.1.8-3_amd64.deb
/usr/share/games/zatacka/map1.jpg

--> Directory maps is missing.





gdb -q --args zatacka

set height 0
set width 0
set pagination off
directory /home/benutzer/zatacka/orig/zatacka-0.1.8/src
run

Reply via email to