FS#62908 - assuming unsigned char leads to infinite loop in trek, maybe other games
Attached to Project:
Community Packages
Opened by Russell Senior (russell--) - Saturday, 15 June 2019, 23:21 GMT
Last edited by Allan McRae (Allan) - Saturday, 15 June 2019, 23:31 GMT
Opened by Russell Senior (russell--) - Saturday, 15 June 2019, 23:21 GMT
Last edited by Allan McRae (Allan) - Saturday, 15 June 2019, 23:31 GMT
|
Details
Description: bsd-games was apparently written with the
expectation that chars are signed, but archlinux arm assumes
unsigned chars. This lead to some non-zero (1 in 6) chance
of an infinite loop upon entering a quadrant in the trek
game.
Additional info: * package version(s) pkgver=2.17 pkgrel=18 * config and/or log files etc. * link to upstream bug report, if any Steps to reproduce: The problem, at least the most easily triggered, can be found in trek/setup.c line 241: q->holes = ranf(3) - q->stars / 5; q->stars is a random number from 0 to 9, so if holes is zero and stars is >=5 then (char) holes becomes 255 if char is unsigned, or -1 if char is signed. When entering a quadrant, there is an attempt to assign the indicated number of holes to the 10x10 grid, randomly. Since there are only 100 possibilities, all the sectors in the quadrant will be allocated to holes with still 155 holes to go, and there are no more EMPTY sectors to find. Here's a patch that fixes it: diff --git a/trunk/PKGBUILD b/trunk/PKGBUILD index 8889902..3b89651 100644 --- a/trunk/PKGBUILD +++ b/trunk/PKGBUILD @@ -19,7 +20,7 @@ source=("https://ibiblio.org/pub/linux/games/$pkgname-$pkgver.tar.gz" number.c.diff bsd-games-2.17-64bit.patch bad-ntohl-cast.diff null-check.diff) md5sums=('238a38a3a017ca9b216fc42bde405639' - '2ea80281ee9993a9ee47323e78349a2a' + 'bec31b913bf0b77edee55498bade29f4' '784f68c796b9e099ac008aecef1af998' '9c0fa6e2345bd0a7945c9a41d5ba68aa' '5356bd6999ae53dd27cb2a0f837a3e70' diff --git a/trunk/config.params b/trunk/config.params index f061d8f..0c55367 100644 --- a/trunk/config.params +++ b/trunk/config.params @@ -13,3 +13,4 @@ bsd_games_cfg_do_chown=n bsd_games_cfg_sail_dir=/tmp bsd_games_cfg_sail_dir_perms=0777 bsd_games_cfg_hack_dir_perms=0777 +bsd_games_cfg_other_cflags=-fsigned-char |
This task depends upon
Closed by Allan McRae (Allan)
Saturday, 15 June 2019, 23:31 GMT
Reason for closing: None
Additional comments about closing: Report to archlinux arm
Saturday, 15 June 2019, 23:31 GMT
Reason for closing: None
Additional comments about closing: Report to archlinux arm