#575610 starvoyager: shows odd speeds on amd64

Package:
starvoyager
Source:
starvoyager
Description:
2D space arcade game, themed around 'Star Trek' - binary
Submitter:
Timo Juhani Lindfors
Date:
2025-08-19 00:39:02 UTC
Severity:
normal
#575610#5
Date:
2010-03-27 17:21:41 UTC
From:
To:
Steps to reproduce:
1) hit 1
2) type foobar
3) hit 0
4) hit up

Expected results:
4) positive speed is shown

Actual results:
4) very large negative speed is shown. gdb shows it is trying to print
"0.0-9223372036854775808 c"

More info:
4) This seems to only happen when traveling "up". If I turn the ship
it shows "0.03 c" correctly.

#575610#10
Date:
2025-08-18 21:16:43 UTC
From:
To:
I believe the issues you're seeing are due to wrong types and format
specifiers on 64-bit systems. They disappear if you compile to a 32-bit
executable or if you use the proper types from stdint.h.
This game is from 2002, it is likely expecting long to be a 32-bit type and
not a 64-bit type and hence has buffer sizes for sprintf that correspond to
that. At least for me locally, after getting past dozens of compiler
warnings, changing the code to use int32_t where appropriate fixes these
bugs.

#575610#15
Date:
2025-08-19 00:02:25 UTC
From:
To:
Building the game with -fsanitize=address also reveals several buffer
overflows.
This game also ships a server component so this may be security relevant.

#575610#20
Date:
2025-08-19 00:37:29 UTC
From:
To:
I think I might have been wrong about that last part, I introduced an out
of bounds read when fixing a compiler warning about a too small buffer.
However for some reason it doesn't still boot with asan enabled, the output
is just empty. That might be worth investigating assuming it's not some
known issue with sdl or similar.