Attached patch makes those cost values unsigned. This is unlikely enough to resolve all cases where the overflow occurs, but should at least reduce their number.
(Maybe new tickets about moving the function to ailog.c, and another about not calculating those values at all when actual logging is not taking place)
From https://osdn.net/projects/freeciv/ticket/46286#comment:12505:46286:1679918727 reported by alain_bkr:
5 ../../../ai/default/aitools.c:378:18: runtime error: signed integer overflow
1 ../../../ai/default/aitools.c:378:41: runtime error: signed integer overflow
Those are in dai_log_path()