SKY: Bogus code
|Reported by:||fingolfin||Owned by:||SF/olki|
|Cc:||Game:||Beneath a Steel Sky|
GCC 4 produces the following warning:
sky/logic.cpp: In member function uint16 Sky::Logic::script(uint16, uint16): sky/logic.cpp:1340: warning: operation on scriptData may be undefined
Indeed, that code is not well-defined: scriptData += READ_LE_UINT16(scriptData++)/2 - 1;
In particular, depending on the compiler, scriptData might end up off by one in either direction. The change was introduced by olki here:
Looking at the old code, I believe this line should really be:
scriptData += READ_LE_UINT16(scriptData)/2;
I might be mistaken, though.
Ticket imported from: #1224968. Ticket imported from: bugs/2071.