CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.21k stars 4.11k forks source link

repairing clothing segfault #74254

Closed mischief closed 3 weeks ago

mischief commented 3 months ago

Describe the bug

repairing clothing with a tailor kit causes a segfault in the activity handler:

mischief@sokoban:~/Downloads/cataclysmdda-0.I $ ./cataclysm
The program has crashed.
See the log file for a stack trace.
CRASH LOG FILE: ./config/crash.log
VERSION: cdda-experimental-2024-06-02-0340 55c740a
TYPE: Signal
MESSAGE: SIGSEGV: Segmentation fault
STACK TRACE:

    0x564,f02,b71,9d1    src/debug.cpp:966    bt_full
    0x564,f02,b71,9d1    src/debug.cpp:1,231    debug_write_backtrace(std::ostream&)
    0x564,f02,b4a,41d    src/crash.cpp:89    log_crash
    0x564,f02,b4a,773    src/crash.cpp:146    signal_handler
    0x7ff,14e,c58,57f    [unknown src]:0    [unknown func]
    0x564,f02,e06,f17    src/item.cpp:936    item::is_null() const
    0x564,f02,f3c,a53    src/iuse_actor.cpp:2,916    repair_item_actor::can_repair_target(Character&, item const&, bool, bool) const
    0x564,f02,8d5,4d9    src/activity_handlers.cpp:2,505    repair_item_finish(player_activity*, Character*, bool)
    0x564,f02,902,d93    /usr/include/c++/9/bits/std_function.h:688    std::function<void (player_activity*, Character*)>::operator()(player_activity*, Character*) const
    0x564,f02,902,010    src/activity_type.cpp:167    activity_type::call_finish(player_activity*, Character*) const
    0x564,f03,40d,c73    src/player_activity.cpp:393    player_activity::do_turn(Character&)
    0x564,f02,bd5,c86    src/do_turn.cpp:531    do_turn()
    0x564,f02,70b,4f5    src/main.cpp:873    main
    0x7ff,14e,c42,c89    [unknown src]:0    [unknown func]
    0x7ff,14e,c42,d44    [unknown src]:0    [unknown func]
    0x564,f02,859,2fd    [unknown src]:0    [unknown func]
    0xf,fff,fff,fff,fff,fff    [unknown src]:0    [unknown func]
Aborted (core dumped)

Attach save file

Plainsboro-trimmed.tar.gz

Steps to reproduce

in the attached save, (a)pply tailor kit, (2) repair each work clothing, and (3) Refit or repair until success/failure/level up.

Expected behavior

not crash.

Screenshots

No response

Versions and configuration

cdda-linux-curses-x64-2024-06-02-0340.tar.gz / debian sid

Additional context

backtrace on a from source build with symbols:

gdb$ bt
#0  0x0000563cdb245c0a in item::is_null (this=0x0) at ../src/item.cpp:936
#1  0x0000563cdb3eade6 in repair_item_actor::can_repair_target (this=0x563cf2cd45a0, pl=..., fix=..., print_msg=0x1, check_consumed_available=0x1) at ../src/iuse_actor.cpp:2916
#2  0x0000563cdc113063 in repair_item_finish(player_activity*, Character*, bool) [clone .constprop.0] (act=0x563cea62e598, you=0x563cea62de80, no_menu=<optimized out>) at ../src/activity_handlers.cpp:2505
#3  0x0000563cdbb41081 in std::function<void (player_activity*, Character*)>::operator()(player_activity*, Character*) const (this=<optimized out>, __args#0=0x563cea62e598, __args#1=0x563cea62de80) at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/std_function.h:591
#4  activity_type::call_finish (this=<optimized out>, act=0x563cea62e598, you=0x563cea62de80) at ../src/activity_type.cpp:167
#5  player_activity::do_turn (this=0x563cea62e598, you=...) at ../src/player_activity.cpp:393
#6  0x0000563cdaf48423 in do_turn () at ../src/do_turn.cpp:531
#7  0x0000563cdaa4d435 in main (argc=<optimized out>, argv=<optimized out>) at ../src/main.cpp:873

it seems that the activity target in https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/activity_handlers.cpp#L2469 somehow disappeared

github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.