cargo_iter_next() uses -1 array index
Reported by alain_bkr in https://osdn.net/projects/freeciv/ticket/47748#comment:12505:47748:1681095349 :
> ../../common/unit.c:2475:13: runtime error: index -1 out of bounds for type 'const struct unit_list_link *[5]' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../common/unit.c:2475:13 in
This was with S3_1.
The difference between attached patches is that main / S3_2 one adds an assert that more stable branches patch does not.
S3_1/S3_0 patch also for S2_6.
Likely duplicate -> #47661
this does not fix the problem
#47982 has the complete fix
Reported by alain_bkr in https://osdn.net/projects/freeciv/ticket/47748#comment:12505:47748:1681095349 :
This was with S3_1.