[Freeciv-tickets] [freeciv] #46176: Segfault from dai_hunter_manage

アーカイブの一覧に戻る
OSDN Ticket System norep****@osdn*****
Sun Dec 4 04:30:01 JST 2022


#46176: Segfault from dai_hunter_manage

  Open Date: 2022-12-03 21:15
Last Update: 2022-12-03 21:30

URL for this Ticket:
    https://osdn.net//projects/freeciv/ticket/46176
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=46176

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2022-12-03 21:30 Updated by: cazfi

Comment:

By quick look at the source code it seems that hunter never checks if it can actually attack the target it considers, and thus it's possible that even target itself doesn't get chosen as the defender of its tile.
Trivial fix would be to skip the unit_win_chance() call when there's no defender.
Better fix would include confirming that target can be hunted, so that hunter would not waste turns on a pointless hunt. However, it should probably take in to account also whether the hunter has missiles able to attack the target.

---------------------------------------------------------------------
Ticket Status:

      Reporter: lexxie9952
         Owner: (None)
          Type: Bugs
        Status: Open
      Priority: 5 - Medium
     MileStone: (None)
     Component: (None)
      Severity: 5 - Medium
    Resolution: None
---------------------------------------------------------------------

Ticket details:

Segfault in FCW server appears to have possibility for same issue in upstream server.
blamed: dai_hunter_manage() called unit_win_chance() with a null pdefender
stack trace:
Program terminated with signal SIGSEGV, Segmentation fault.
#0  get_defense_power (punit=0x0) at ../../freeciv/common/combat.c:550
550       struct tile *ptile = unit_tile(punit);
[Current thread is 1 (Thread 0x7f67c4151800 (LWP 26778))]
#0  get_defense_power (punit=0x0) at ../../freeciv/common/combat.c:550
#1  get_total_defense_power (defender=0x0, attacker=0x55fc042954f0)
    at ../../freeciv/common/combat.c:710
#2  unit_win_chance (attacker=attacker at entry=0x55fc042954f0, defender=0x0)
    at ../../freeciv/common/combat.c:409
#3  0x000055fc0158dba5 in dai_hunter_manage (ait=ait at entry=0x55fc01ba4640 <ai_types>,
    pplayer=pplayer at entry=0x55fc05c60dd0, punit=punit at entry=0x55fc042954f0)
    at ../../../freeciv/ai/default/aihunt.c:523
#4  0x000055fc0158e5eb in eval_hunter_want (veteran=<optimized out>,
    best_type=0x55fc02345730 <unit_types+115920>, choice=0x55fc043d6f30,
    pcity=0x55fc05e5edf0, pplayer=0x55fc05c60dd0, ait=0x55fc01ba4640 <ai_types>)
    at ../../../freeciv/ai/default/aihunt.c:243
#5  dai_hunter_choice (ait=ait at entry=0x55fc01ba4640 <ai_types>,
    pplayer=pplayer at entry=0x55fc05c60dd0, pcity=pcity at entry=0x55fc05e5edf0,
    choice=choice at entry=0x55fc043d6f30, allow_gold_upkeep=allow_gold_upkeep at entry=true)
    at ../../../freeciv/ai/default/aihunt.c:280
#6  0x000055fc015858ff in military_advisor_choose_build (
    ait=ait at entry=0x55fc01ba4640 <ai_types>, pplayer=pplayer at entry=0x55fc05c60dd0,
    pcity=pcity at entry=0x55fc05e5edf0, mamap=<optimized out>, ul_cb=ul_cb at entry=0x0)
    at ../../../freeciv/ai/default/daimilitary.c:1677
#7  0x000055fc015764f9 in dai_manage_cities (ait=ait at entry=0x55fc01ba4640 <ai_types>,
    pplayer=pplayer at entry=0x55fc05c60dd0) at ../../../freeciv/ai/default/daicity.c:884
#8  0x000055fc01561d3f in dai_do_last_activities (ait=0x55fc01ba4640 <ai_types>,
    pplayer=<optimized out>) at ../../../freeciv/ai/default/aihand.c:772
#9  0x000055fc01424800 in end_phase () at ../../freeciv/server/srv_main.c:1531
#10 srv_running () at ../../freeciv/server/srv_main.c:3046


-- 
Ticket information of Freeciv project
Freeciv Project is hosted on OSDN

Project URL: https://osdn.net/projects/freeciv/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net/projects/freeciv/ticket/46176
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=46176



More information about the Freeciv-tickets mailing list
アーカイブの一覧に戻る