URL:
  <http://gna.org/bugs/?21900>

                 Summary: Segmentation fault in utype_has_flag in Freeciv-web
                 Project: Freeciv
            Submitted by: andreasr
            Submitted on: Wed 09 Apr 2014 04:31:13 PM UTC
                Category: freeciv-web
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
                 Release: 
         Discussion Lock: Any
        Operating System: GNU/Linux
         Planned Release: 

    _______________________________________________________

Details:

Hi!

I get some segmentation faults in utype_has_flag in unittype.c, for some
Freeciv-web games. This is from Freeciv revision 24737 running on the
production server http//play.freeciv.org/

Any help fixing this? I'm not sure if this is a Freeciv-web specific bug, or a
general problem in the Freeciv C server. I vaguely remember some segmentation
fault fixes in action_prob recently, perhaps this is related.

Backtrace generated from coredump:

Program terminated with signal 11, Segmentation fault.
#0  0x081ac007 in utype_has_flag (punittype=0x0, flag=23) at unittype.c:190
        flag = 23
        punittype = 0x0
#1  0x0812b228 in ap_diplomat_battle (pdefender=0x95ba150, pattacker=0x0)
    at actions.c:481
        chance = <optimized out>
#2  action_prob (wanted_action=wanted_action@entry=ACTION_SPY_SABOTAGE_UNIT,
    actor_player=0x0, actor_tile=actor_tile@entry=0x0,
    actor_unit=actor_unit@entry=0x0,
    target_player=target_player@entry=0x9d49048,
    target_city=target_city@entry=0x9a41208,
    target_tile=target_tile@entry=0xb692e2d0,
    target_unit=target_unit@entry=0x95ba150, target_specialist=0x0,
    target_output=0x0, target_building=0x0, actor_specialist=0x0,
    actor_output=0x0, actor_building=0x0, actor_city=0x0) at actions.c:580
        known = 2
        chance = 254
#3  0x0812bbf4 in action_prob_vs_unit (actor_unit=actor_unit@entry=0x0,
    action_id=action_id@entry=1, target_unit=target_unit@entry=0x95ba150)
    at actions.c:688
No locals.
#4  0x080e01ec in handle_unit_get_actions (
    pc=pc@entry=0x82977a0 <connections>, actor_unit_id=4888,
    target_tile_id=2298) at unithand.c:242
        act = 1
        actor_player = <optimized out>
        actor_unit = 0x0
        target_tile = <optimized out>
        probabilities = {255, 0, 0, 0, 0, 0, 0, 0, 0, 0}
        target_unit = 0x95ba150
        target_city = 0x9a41208
#5  0x0809d879 in server_handle_packet (
    type=type@entry=PACKET_UNIT_GET_ACTIONS, packet=packet@entry=0x8b134e0,
    pplayer=pplayer@entry=0x9a56248, pconn=pconn@entry=0x82977a0
<connections>)
    at hand_gen.c:250
No locals.
#6  0x08051608 in server_packet_input (
    pconn=pconn@entry=0x82977a0 <connections>, packet=0x8b134e0, type=87)
    at srv_main.c:1702
        pplayer = 0x9a56248
        __FUNCTION__ = "server_packet_input"
#7  0x080d58c7 in incoming_client_packets (pconn=<optimized out>)
    at sernet.c:450
        command_ok = <optimized out>
        packet = {data = 0x8b134e0, type = PACKET_UNIT_GET_ACTIONS}
#8  server_sniff_all_input () at sernet.c:842
        pconn = 0x82977a0 <connections>
        nb = <optimized out>
        i = <optimized out>
        s = <optimized out>
        max_desc = <optimized out>
        readfs = {fds_bits = {128, 0 <repeats 31 times>}}
        writefs = {fds_bits = {0 <repeats 32 times>}}
        exceptfs = {fds_bits = {0 <repeats 32 times>}}
        tv = {tv_sec = 0, tv_usec = 999997}
        __FUNCTION__ = "server_sniff_all_input"
#9  0x08052e2d in srv_running () at srv_main.c:2401
        save_counter = 1
        i = <optimized out>
        is_new_turn = true
        skip_mapimg = false
        eot_timer = <optimized out>
        need_send_pending_events = false
#10 srv_main () at srv_main.c:2879
        __FUNCTION__ = "srv_main"
#11 0x0804cb02 in main (argc=17, argv=0xbf922c14) at civserver.c:458
        inx = 17
        showhelp = <optimized out>
        showvers = <optimized out>
        s = <optimized out>
        max_desc = <optimized out>
        readfs = {fds_bits = {128, 0 <repeats 31 times>}}
        writefs = {fds_bits = {0 <repeats 32 times>}}
        exceptfs = {fds_bits = {0 <repeats 32 times>}}
        tv = {tv_sec = 0, tv_usec = 999997}
        __FUNCTION__ = "server_sniff_all_input"
#9  0x08052e2d in srv_running () at srv_main.c:2401
        save_counter = 1
        i = <optimized out>
        is_new_turn = true
        skip_mapimg = false
        eot_timer = <optimized out>
        need_send_pending_events = false
#10 srv_main () at srv_main.c:2879
        __FUNCTION__ = "srv_main"
#11 0x0804cb02 in main (argc=17, argv=0xbf922c14) at civserver.c:458
        inx = 17
        showhelp = <optimized out>
        showvers = <optimized out>
---Type <return> to continue, or q <return> to quit---
        option = <optimized out>
        __FUNCTION__ = "main"




This is what the function in unittype.c looks like:

/**************************************************************************
  Return whether the given unit type has the flag.
**************************************************************************/
bool utype_has_flag(const struct unit_type *punittype, int flag)
{
  fc_assert_ret_val(unit_type_flag_id_is_valid(flag), FALSE);
  return BV_ISSET(punittype->flags, flag);
}






    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?21900>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to