Menu

#844 Segfault in Darcap Library

None
closed
None
5
2018-06-26
2018-01-09
SilverNexus
No

My recent tweaks to the artifact generation to get the identified face on specific things like monsters and gems seem to cause a problem. In the current trunk (r20538), the loading of specific items (I think some sort of readable) segfaults the server. In particular, I seem to be getting it to consistently segfault at the Darcap library, but it has occurred elsewhere.

Making note of the issue here, but I should be able to investigate (and hopefully fix) this tomorrow.

Discussion

  • Kevin Zheng

    Kevin Zheng - 2018-01-09

    I've reproduced the issue:

    Program received signal SIGSEGV, Segmentation fault.
    0x00000000004e9310 in object_get_key_value (ob=0x20, key=0x804685f14 "identified_face") at object.c:4221
    (gdb) bt
    #0  0x00000000004e9310 in object_get_key_value (ob=0x20, key=0x804685f14 "identified_face") at object.c:4221
    #1  0x00000000004e94c3 in object_set_value_s (op=0x80745c590, canonical_key=0x804685f14 "identified_face", value=0x0, add_key=0) at object.c:4308
    #2  0x00000000004e93d6 in object_set_value (op=0x80745c590, key=0x551d85 "identified_face", value=0x0, add_key=0) at object.c:4390
    #3  0x00000000004bf758 in object_give_identified_properties (op=0x80745c590) at item.c:1388
    #4  0x00000000004b0571 in add_abilities (op=0x80745c590, change=0x804249a00) at artifact.c:333
    #5  0x00000000004f0b99 in artifact_describe (art=0x8047c05e0, al=0x8042b3e20, message=1, art_name=2, separator=0) at readable.c:1604
    #6  0x00000000004eed48 in artifact_msg (level=6, booksize=729) at readable.c:1681
    #7  0x00000000004ee8c1 in tailor_readable_ob (book=0x80741a770, msg_type=2) at readable.c:2058
    #8  0x00000000004f9109 in fix_generated_item (op=0x80741a770, creator=0x80741b1b0, difficulty=5, max_magic=0, flags=0) at treasure.c:1298
    #9  0x00000000004f7f7a in create_one_treasure (tl=0x8043a7a60, op=0x80741b1b0, flag=0, difficulty=5, tries=2) at treasure.c:469
    #10 0x00000000004f7c9f in create_treasure (t=0x8043a7a60, op=0x80741b1b0, flag=0, difficulty=5, tries=1) at treasure.c:496
    #11 0x000000000040bcd4 in apply_auto (op=0x80741b1b0) at apply.c:1361
    #12 0x000000000040c00a in apply_auto_fix (m=0x805bf6400) at apply.c:1407
    #13 0x00000000004d7b6a in mapfile_load (map=0x7ffffff95fc0 "/darcap/darcap/library_ground", flags=0) at map.c:1280
    #14 0x00000000004dab10 in ready_map_name (name=0x7ffffff95fc0 "/darcap/darcap/library_ground", flags=0) at map.c:1832
    #15 0x0000000000403ab3 in enter_exit (op=0x8048434a0, exit_ob=0x8072702c0) at server.c:747
    #16 0x0000000000527327 in exit_type_apply (context=0x812470 <type_methods+3168>, exit=0x8072702c0, op=0x8048434a0, autoapply=0) at exit/exit.c:169
    #17 0x00000000004dd6b6 in ob_apply (op=0x8072702c0, applier=0x8048434a0, aflags=0) at ob_methods.c:48
    #18 0x000000000040945a in apply_manual (op=0x8048434a0, tmp=0x8072702c0, aflag=0) at apply.c:532
    #19 0x0000000000409739 in apply_by_living (pl=0x8048434a0, op=0x80738b2b0, aflag=0, quiet=1) at apply.c:585
    #20 0x0000000000409a0b in apply_by_living_below (pl=0x8048434a0) at apply.c:651
    #21 0x0000000000497d4c in command_apply (op=0x8048434a0, params=0x7ffffffa7465 "") at c_object.c:201
    #22 0x00000000004abff3 in execute_newserver_command (pl=0x8048434a0, command=0x7ffffffa7460 "apply") at c_new.c:141
    #23 0x000000000051aadd in new_player_cmd (buf=0x805b81af7 "", len=11, pl=0x805b7acc0) at request.c:487
    #24 0x0000000000515b20 in handle_cmd (ns=0x805b7acc8, pl=0x805b7acc0, cmd=0x805b81af2 "ncom", data=0x805b81af7 "", len=11) at loop.c:216
    #25 0x00000000005158e5 in handle_client (ns=0x805b7acc8, pl=0x805b7acc0) at loop.c:271
    #26 0x000000000051682a in do_server () at loop.c:631
    #27 0x0000000000406a43 in server_main (argc=1, argv=0x7fffffffe7d8) at server.c:1419
    #28 0x00000000004035cb in main (argc=1, argv=0x7fffffffe7d8) at main.c:26
    

    It looks like something is going wrong when you call objectgetkeyvalue while calling fix_generated_item on random reading in a bookshelf.

     
  • SilverNexus

    SilverNexus - 2018-01-09

    Yeah. It seems to fix it if I ensure there is op->arch before calling object_give_identified_properties. This should fix it even if it is not a book in a bookshelf causing the problem.
    Patching via r20539.

     
  • SilverNexus

    SilverNexus - 2018-01-09
    • status: open --> patched
     
  • SilverNexus

    SilverNexus - 2018-01-16

    Seems to be not segfaulting anywhere. Closing.

     
  • SilverNexus

    SilverNexus - 2018-01-16
    • status: patched --> closed
     

Log in to post a comment.