ThibaultLemaire/HomeworldSDL

Segfault in proximity sensor ping

Opened this issue · 0 comments

Steps to reproduce

Let an enemy ship enter the detection range of a proximity sensor.

Backtrace

#0  ProximitySensorPingTimeout (hellaPing=0x7ffff624cdf0, userID=4132318528, userData=0x7ffff624ce68 "\241\266VF", bRemoveReferences=0) at ../../../src/Ships/ProximitySensor.c:260
#1  0x00005555556ed55e in pingUpdateTask (taskContextPtr=0x7ffff6e2fe18) at ../../../src/Game/Ping.c:173
#2  pingUpdateTask (taskContextPtr=0x7ffff6e2fe18) at ../../../src/Game/Ping.c:151
#3  0x000055555572bc54 in taskExecuteAllPending (ticks=4) at ../../../src/Game/Task.c:370
#4  0x00005555555f1eea in utyTasksDispatch () at ../../../src/SDL/utility.c:4726
#5  0x00005555555ce085 in main (argc=<optimized out>, argv=<optimized out>) at ../../../src/SDL/main.c:2236

Leads

Again it seems to be a simple matter of truncated pointers. The userID parameter is cast to a Ship * (8 bytes of size) but it's a udword (4 bytes). The userID should be a memsize.

This is a pretty major bug. Mission 12 - Galactic Core requires proximity sensors.