Actions
Bug #1646
openFixed a SIGSEGV in unit_order_list_is_sane()
Start date:
08/05/2025
Due date:
% Done:
0%
Estimated time:
Description
For various reasons, during the save or load of a game file, if a unit's action list is rejected, the process will delete the working memory for the unit's "order's list" and set the order's list pointer to NULL.
Later, the 'data sanity check' accesses the NULL memory pointer and throws a SIGSEGV exception.
The proposed fix performs the following:- adds a guard against the use of the NULL pointer. But returns TRUE for sanity, as the list is empty.
- provides additional cleanup by zeroing out the length value in the 'orders' structure. Note: zeroing out the length would have avoided the NULL memory access, but still leaves the 'sanity' ambiguous.
- avoid the 'sanity' check on empty (NULL) order action lists for the unit. Note, the `punit->has_orders` could be refactored to only use the `puint->orders.length == 0`.
Files
Actions