#679875 ace-of-penguins: Games crash when trying to view help screen

Package:
ace-of-penguins
Source:
ace-of-penguins
Description:
penguin-themed solitaire games
Submitter:
Lukas Hofmann
Date:
2022-05-02 22:12:03 UTC
Severity:
minor
Tags:
#679875#5
Date:
2012-07-02 08:24:18 UTC
From:
To:
Dear Maintainer,

Whenever I press F1 or h to view the help screen in any ace-of-penguins game it crashes with a Segmentation fault.
This happens in all of the included games except in canfield, which doesn't react to F1 or h at all.

#679875#10
Date:
2012-07-09 09:28:49 UTC
From:
To:
severity 679875 minor
tags 679875 + unreproducible
thanks

2012-07-02 11:24 Lukas Hofmann <lhfloss@gmx.de>:
| Architecture: amd64 (x86_64)
| Package: ace-of-penguins
| Version: 1.3-8
| Severity: normal
|
| Dear Maintainer,
|
| Whenever I press F1 or h to view the help screen in any ace-of-penguins
| game it crashes with a Segmentation fault. This happens in all of the
| included games except in canfield, which doesn't react to F1 or h at all.

I tested both in i386 and amd64 but the F1 key works normally; brings up
game info screen.

It's hard to tell what is different in your environemt. Could you:

    1. Update all to latest

       apt-get update && apt-get dist-upgrade

    2. Try removing the package and installing it fresh

       apt-get --purge remove ace-of-penguins
       apt-get install ace-of-penguins

    3. If F1 still brings up segmentation fault, please send strace:

        : > /tmp/strace.log
        strace -o /tmp/strace.log /usr/games/ace-freecell

    4. send *.log as an attachment to this bug report

Until then, downgrading the severity.

Thanks,
Jari

#679875#15
Date:
2012-07-09 09:28:49 UTC
From:
To:
severity 679875 minor
tags 679875 + unreproducible
thanks

2012-07-02 11:24 Lukas Hofmann <lhfloss@gmx.de>:
| Architecture: amd64 (x86_64)
| Package: ace-of-penguins
| Version: 1.3-8
| Severity: normal
|
| Dear Maintainer,
|
| Whenever I press F1 or h to view the help screen in any ace-of-penguins
| game it crashes with a Segmentation fault. This happens in all of the
| included games except in canfield, which doesn't react to F1 or h at all.

I tested both in i386 and amd64 but the F1 key works normally; brings up
game info screen.

It's hard to tell what is different in your environemt. Could you:

    1. Update all to latest

       apt-get update && apt-get dist-upgrade

    2. Try removing the package and installing it fresh

       apt-get --purge remove ace-of-penguins
       apt-get install ace-of-penguins

    3. If F1 still brings up segmentation fault, please send strace:

        : > /tmp/strace.log
        strace -o /tmp/strace.log /usr/games/ace-freecell

    4. send *.log as an attachment to this bug report

Until then, downgrading the severity.

Thanks,
Jari

#679875#24
Date:
2012-07-09 09:40:32 UTC
From:
To:
I dist-upgraded my system and reinstalled ace-of-penguins just as
requested.

Here is my strace.log

#679875#29
Date:
2012-07-09 09:44:09 UTC
From:
To:
I dist-upgraded my system and reinstalled ace-of-penguins as requested.

Here is my strace.log

#679875#34
Date:
2012-07-09 10:01:53 UTC
From:
To:
Sorry for sending my reply twice. I did a mistake sending it with my
mail client.

I examined the log-file and found out that some fonts were missing.
After installing the package xfonts-100dpi everything works fine now.

Sorry for making you unnecessary work.

#679875#39
Date:
2012-07-09 12:57:09 UTC
From:
To:
On 2012-07-09 12:01, Lukas Hofmann wrote:
| Sorry for sending my reply twice. I did a mistake sending it with my
| mail client.
|
| I examined the log-file and found out that some fonts were missing.
| After installing the package xfonts-100dpi everything works fine now.
|
| Sorry for making you unnecessary work.

Not at all. Thanks for taking the time to debug this. I'll add that fonts to Depends.

Jari

#679875#44
Date:
2012-07-10 18:17:10 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
ace-of-penguins, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 679875@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Jari Aalto <jari.aalto@cante.net> (supplier of updated ace-of-penguins package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)
Format: 1.8
Date: Tue, 10 Jul 2012 12:47:52 +0300
Source: ace-of-penguins
Binary: ace-of-penguins
Architecture: source amd64
Version: 1.3-9
Distribution: unstable
Urgency: low
Maintainer: Jari Aalto <jari.aalto@cante.net>
Changed-By: Jari Aalto <jari.aalto@cante.net>
Description:
 ace-of-penguins - penguin-themed solitaire games
Closes: 679875
Changes:
 ace-of-penguins (1.3-9) unstable; urgency=low
 .
   * debian/control
     - (Recommends): Add xfonts-100dpi. This fixes F1 keypress
       segmentation fault crash on systems which do not already have the font
       installed (Closes: #679875). Thanks to Lukas Hofmann <lhfloss@gmx.de>
       for the patch.
Checksums-Sha1:
 65d419799ea0a40c4b1de862f8181fb2cb3d7911 1966 ace-of-penguins_1.3-9.dsc
 9bd72f5111107cf7339b7fd65d5e1d9bbd1e3985 36572 ace-of-penguins_1.3-9.debian.tar.gz
 c1f7c37365e4552e81be38de729f9edc67825056 283912 ace-of-penguins_1.3-9_amd64.deb
Checksums-Sha256:
 822ca4fba0c120448d109033a1adb4a5e6c5447da1c337f390a7fb2f0c14e635 1966 ace-of-penguins_1.3-9.dsc
 e47558838a300561cf053932679c654e453891b78aae3969aa57e57ea1fcd3d7 36572 ace-of-penguins_1.3-9.debian.tar.gz
 2a055e5ee1d37fb57b0c79686f5ae9e13a2974f9017efbae40c4f7640dee989f 283912 ace-of-penguins_1.3-9_amd64.deb
Files:
 d5efd7836690e86f7fc03835b178c68e 1966 games optional ace-of-penguins_1.3-9.dsc
 be112f4aa5089b2e3c4a851a5757e507 36572 games optional ace-of-penguins_1.3-9.debian.tar.gz
 ba2c85c1c5c4fa2dee873df2c8dcaedb 283912 games optional ace-of-penguins_1.3-9_amd64.deb
iQIcBAEBAgAGBQJP/HBXAAoJECHSBYmXSz6W1UkP/22HLtnEoKVh5mJf+JGiUFz3
Qi2DkNixuvE/21JwKX/ie6wiMOEA4msjYiFL0EukfX9eQcr1ef0m03Hugisa99jF
jbAMm4RMfRYGTh2b43TK0vObGCeGGgZLcu39j0C/XX8zkrlJFNH55gyXv1KHM80K
SA6IzlZ6jmNsMiQucJkW8x/geMPVIa1irMre5GDMO3lHIaYWfeJXMqjqAHCE+Rbq
AZ22X5OVg6Xgjqzdj2et8cTexf9JVQq+zxbL3KLK8iik5Z25SM7+oZvfIu9SrPix
uCiPWry5H7ZJINia7+4zz550OHUNWYd3xuWt/6rTYrpLrkTtfSPEkBs8OOTlO3Rq
xXIlCyCNk6tmZnn0JSQyosV0517l3jTfC/wRxRKoDALuZpt5OoX2pTPoPvfjLn27
LnchlDKh0VuPpL4cm/QcrCydcaBp790OAE465zanUsl/Trs9NM8SP2Pi2iBFODLi
TdhoGMuVZT7Q0lhAfKbBvg6lrJK+chzzG0LhJBAhIGRnzns2plF/vI6W7pINOA/t
qVTTNgxD+nqngy7TYqhsJLivewqprXrOlZ0axMwMohMOxWvkEIfy2QkhzafHjhtz
VKKSok7FDFdXUMXTE2Rl0UcLyzVQk0AqGy5aR/yfwsEocrCTg0NukRULEql16zFC
QoKkKyaOzqasq7v0mibP
=SanW
-----END PGP SIGNATURE-----

#679875#49
Date:
2012-08-15 09:56:06 UTC
From:
To:
FYI, why debian/control::Recommends is used in place of Depends
---------------------------------------------------------------

The Policy disallows any package for requiring fonts prior
installing the software:

http://lists.debian.org/debian-policy/2008/07/msg00173.html

        "This is because the X server may retrieve fonts from the
        local file system or over the network from an X font server;
        the Debian package system is empowered to deal only with the
        local file system."

For more information in same thread later:

http://lists.debian.org/debian-policy/2008/07/msg00176.html

        The reason for the Policy requirement for Recommends is to
        enable font servers and not require all the fonts be installed
        locally when you're running a font server.

#679875#54
Date:
2012-11-02 02:32:16 UTC
From:
To:
tags 679875 + upstream - unreproducible
found 679875 ace-of-penguins/1.3-10
quit

| Program received signal SIGSEGV, Segmentation fault.
| 0x00007ffff76a5150 in XTextWidth () from /usr/lib/x86_64-linux-gnu/libX11.so.6
| (gdb) bt
| #0  0x00007ffff76a5150 in XTextWidth () from /usr/lib/x86_64-linux-gnu/libX11.so.6
| #1  0x00007ffff7bcf3b1 in help_init () at help.c:179
| #2  help (filename=0x555555556eaa "freecell.html",
|     text=0x5555557590c0 "<h1>Freecell</h1>\n<img align=left src=xemboss>\n<img align=right src=as>\n\n<h2><i>The Ace of Penguins</i></h2>\n\n<h2><tt>Freecell</tt></h2>\n<p>Copyright \251 1998, 2001 by DJ Delorie <tt><dj@delorie.com><br"...) at help.c:390
| #3  0x00007ffff7bcdc99 in table_loop () at table.c:463
| #4  0x0000555555555710 in main (argc=1, argv=0x7fffffffe868) at freecell.c:654

Here's a quick patch to demonstrate where the problem is.

diff --git i/lib/help.c w/lib/help.c
index a8dcd3d4..66805531 100644
--- i/lib/help.c
+++ w/lib/help.c
@@ -176,6 +176,8 @@ help_init()
   {
     if (!fonts[i])
       fonts[i] = XLoadQueryFont(display, i & STYLE_TT ? "fixed" : "variable");
+    if (!fonts[i])
+      exit(1);
     thin_space[i] = XTextWidth(fonts[i], " ", 1);
   }
   for (i=0; i<NTAGS; i++)
diff --git i/lib/xwin.c w/lib/xwin.c
index 2c8fcfaf..658fa3e8 100644
--- i/lib/xwin.c
+++ w/lib/xwin.c
@@ -217,6 +217,7 @@ xwin_init(int argc, char **argv)
   font = XLoadQueryFont(display, "6x13bold");
   if (!font) font = XLoadQueryFont(display, "6x10");
   if (!font) font = XLoadQueryFont(display, "fixed");
+  if (!font) exit(1);
   font_width = font->max_bounds.width;
   font_height = font->ascent + font->descent;

#679875#65
Date:
2012-11-02 05:37:52 UTC
From:
To:
forwarded 679875 dj@delorie.com
thanks

Hi DJ,

The font problem is still present. Could you look at the code to see if
there is a way around the problem when font is not available. The previous
discussion is at:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=679875

If all others fail, perhaps using perror() + exit() is the only solution?

Jari

2012-11-02 04:32 Jonathan Nieder <jrnieder@gmail.com>:
| | Program received signal SIGSEGV, Segmentation fault.
|
| Here's a quick patch to demonstrate where the problem is.
|
| diff --git i/lib/help.c w/lib/help.c
| index a8dcd3d4..66805531 100644
| --- i/lib/help.c
| +++ w/lib/help.c
| @@ -176,6 +176,8 @@ help_init()
|    {
|      if (!fonts[i])
|        fonts[i] = XLoadQueryFont(display, i & STYLE_TT ? "fixed" : "variable");
| +    if (!fonts[i])
| +      exit(1);
|      thin_space[i] = XTextWidth(fonts[i], " ", 1);
|    }
|    for (i=0; i<NTAGS; i++)
| diff --git i/lib/xwin.c w/lib/xwin.c
| index 2c8fcfaf..658fa3e8 100644
| --- i/lib/xwin.c
| +++ w/lib/xwin.c
| @@ -217,6 +217,7 @@ xwin_init(int argc, char **argv)
|    font = XLoadQueryFont(display, "6x13bold");
|    if (!font) font = XLoadQueryFont(display, "6x10");
|    if (!font) font = XLoadQueryFont(display, "fixed");
| +  if (!font) exit(1);
|    font_width = font->max_bounds.width;
|    font_height = font->ascent + font->descent;
|

#679875#72
Date:
2012-11-21 07:18:10 UTC
From:
To:
Hi DJ,

If there are no suitable fonts, it causes program to crash.

Could you look and release a possible fix or workaround[1]. The previous
discussion is at:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=679875

Jari

[1] One possibility would be to use perror() + exit(). Note that due
to Debian policy, programs cannot rely on any fonts being installed.
http://lists.debian.org/debian-policy/2008/07/msg00173.html
http://lists.debian.org/debian-policy/2008/07/msg00176.html

#679875#77
Date:
2021-11-16 20:42:59 UTC
From:
To:
 Good afternoon,
I am contacting you regarding an unclaimed inheritance left by my late
client, your family member. Get back to me  for more details.
Regards,

#679875#82
Date:
2022-05-02 22:08:41 UTC
From:
To:
Dear Maintainer,

the source of the bug is an out of bounds access in a for loop in lib/help.c:515

    int ts = (thin_space[words[i-1].flags & STYLE_BITS]
              + thin_space[words[i].flags & STYLE_BITS])/2;

Iteration starts from i = 0, accessing words[i-1] causes the crash.
The upper bound is wrong aswell. Iteration should terminate for i < nwords, not i <= nwords.