Bug#1010236: xye: Xye is stuck in an infinite loop on arm

Krzysztof Aleksander Pyrkosz krzpyrkosz at gmail.com
Tue Apr 26 21:19:33 BST 2022


Package: xye
Version: 0.12.2+dfsg-9
Severity: grave
Justification: renders package unusable
X-Debbugs-Cc: krzpyrkosz at gmail.com

Dear Maintainer,

Xye relies heavily on x86 specific feature which is signedness of char
type. It builds without errors on armhf and arm64 (and possibly other
architectures that are affected) but hangs in an infinite loop as soon
as "Play" button is pressed. The reason for that is internally all
xy coordinates are represented not by int, but a char. On x86, subtracting
1 from 0 results in -1, on arm 255. This is a root of the problem.

Some examples:
src/xye.cpp:1234
for (j=XYE_VERT-1;j>=0;j--) // j reaches 255 on arm

src/xye:1874
dx= (dx>=XYE_HORZ)?0:(dx<0)?XYE_HORZ-1:dx; // dx is never going to be
less that 0, we can't walk through map's edges


I've spent a while trying to replace chars with ints here and there but I gave up
after seeing how this platform-specific oddity is deeply embedded in the code.
Initially I managed to get  "Play" button to work, but the minions did not move.
Levels containing teleporters were getting stuck in an infinite loop.
I've tried building the program with clang, enabling it's magnificent
-fsanitize=integer feature, that detects (among other things) char overflows.
The log was all red.

The proposed solution is to enforce -fsigned-char in CFLAGS and
CXXFLAGS.

The program worked out of the box, all the issues I've encountered so
far are gone. Tested on armhf and arm64.



More information about the Pkg-games-devel mailing list