jumpnbump crashes when jumping

Bug #1639586 reported by Enno
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Raspbian
Fix Released
Undecided
Unassigned

Bug Description

In the opening screen, when pressing any of the "up" keys to make one of the bunnies jump, the game quits with a Segmentation Fault. The bug seems audio-related, because it goes away when running with the -nosound option.

To reproduce, start the game and press the up arrow key.

A similar bug has been reported for Ubuntu on the PowerPC:
https://bugs.launchpad.net/ubuntu/+source/jumpnbump/+bug/722370

I cannot get this to happen under gdb or valgrind, and the package works in Debian on x86 :-(

Package: jumpnbump
Version: 1.51+dfsg1-2
Severity: normal

-- System Information:
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 8.0 (jessie)
Release: 8.0
Codename: jessie
Architecture: armv7l

Kernel: Linux 4.4.21-v7+ (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages jumpnbump depends on:
ii imagemagick 8:6.8.9.9-5+deb8u5
ii libbz2-1.0 1.0.6-7
ii libc6 2.19-18+deb8u6
ii libsdl-mixer1.2 1.2.12-11+b1
ii libsdl-net1.2 1.2.8-4
ii libsdl1.2debian 1.2.15-10+rpi1
ii python 2.7.9-1
ii python-glade2 2.24.0-4
ii python-gtk2 2.24.0-4
ii zlib1g 1:1.2.8.dfsg-2

jumpnbump recommends no packages.

Versions of packages jumpnbump suggests:
pn jumpnbump-levels <none>

-- no debconf information

Revision history for this message
Hap (happysad) wrote :

Hello from the future. This issue remains with 1.60-4. Note that -musicnosound also works around it.

The game is great, by the way.

Revision history for this message
peter green (plugwash) wrote :

Unfortunately unless you can pinpoint where in the code the crash is happening, I doubt there is much we can do about it.

Revision history for this message
Frank Birbacher (fbirbacher) wrote :

I took the code from https://salsa.debian.org/games-team/jumpnbump and compiled with the -g flag, set “ulimit -c unlimited” and got a core dump. Looking at it with gdb revealed a call stack ending in “stopchan” from sound.c. There doesn't seem anything obvious here and the only way the code could fail is due to an index out of bounds. Following the call stack up leads to this error:

menu.c:357 calls:
dj_play_sfx(SFX_JUMP, (unsigned short)(SFX_JUMP_FREQ + rnd(2000) - 1000), 64, 0, 0, -1);

The last argument is spelled “-1”, but is passed to a “char” and on this platform “char” is unsigned. This is why we get 255 as a value, and the check in dj_play_sfx fails to protect against this condition:
sound.c:371 condition is always true
    if (channel<0) {

The fix is to use “signed char” as the type. Or maybe just int.

Revision history for this message
Frank Birbacher (fbirbacher) wrote :

For reference:

“The ARM ABI defines char as an unsigned byte, and this is the interpretation used by the C++ libraries supplied with the ARM compilation tools.”
https://developer.arm.com/documentation/dui0491/i/C-and-C---Implementation-Details/Character-sets-and-identifiers

Another relevant question:
“By default compiler is assuming char declaration as unsigned char instead of signed char”
https://answers.launchpad.net/gcc-arm-embedded/+question/428043

Revision history for this message
Frank Birbacher (fbirbacher) wrote :

The same issue would affect PPC because “char” is unsigned there as well, re https://bugs.launchpad.net/ubuntu/+source/jumpnbump/+bug/722370

Revision history for this message
peter green (plugwash) wrote :

If you can provide a tested patch that makes the game playable (It would not surprise me if there is more than one such error) I can apply it in raspbian and forward it to Debian.

Revision history for this message
Frank Birbacher (fbirbacher) wrote :

Sure, but I’m afraid I can’t currently provide any code for legal reasons. It might be weeks until I can, or I may not at all.

Revision history for this message
Frank Birbacher (fbirbacher) wrote :
Revision history for this message
peter green (plugwash) wrote :

This fix has been applied in raspbian in versions 1.60-4+rpi1 (for buster) and 1.61-3.1 (for bullseye)

Over in debian it's fixed in 1.61-3.1 in sid and has been unblocked for migration to bullseye.

Changed in raspbian:
status: New → Fix Released
Revision history for this message
Frank Birbacher (fbirbacher) wrote :

I've upgraded to 1.60-4+rpi1 (buster) on my Pi and verified it makes the game playable. :D Thanks for your help!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.