Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game crashes generating faction camp recipes when any of the components has_temperature() #50493

Closed
chrispikula opened this issue Aug 5, 2021 · 4 comments · Fixed by #71806
Closed
Labels
<Bug> This needs to be fixed <Crash / Freeze> Fatal bug that results in hangs or crashes. Items / Item Actions / Item Qualities Items and how they work and interact Mechanics: Temperature Freezing, cooling, thawing, heating, etc. mechanics

Comments

@chrispikula
Copy link
Contributor

Describe the bug

It turns out that when you desire to eat the choicest pieces of rock on the ground, the world has it's revenge by not allowing your existence.

10/10, I had a very good existential horror metagame. Sadly, that's not part of the design doc, so there probably should be a fix.

Steps To Reproduce

Load the game with the following mod:

Thanks to @anothersimulacrum for the code snippet!
[ { "type": "MOD_INFO", "id": "breaks_everything", "name": "Crash the game with this one weird trick!", "description": "Contributors hate him!", "category": "content" }, { "type": "COMESTIBLE", "id": "rock", "copy-from": "rock", "symbol": "*", "color": "light_gray", "name": { "str": "rock" }, "description": "a rock the size of a baseball. makes a decent melee weapon, and is also good for throwing at enemies." } ]

Expected behavior

Being able to char gen, load the game.

Screenshots

No response

Versions and configuration

Win 10, tiles, b840294.

game report.txt

Additional context

No response

@Hirmuolio
Copy link
Contributor

Hirmuolio commented Aug 5, 2021

It seems like mapgen problem.

Making rock into comestible gives it temperature.
It then tries to get the heat radiation that does not exst before the game properly begins.
Why rocks specifically get placed on map at this point is a mystery to me.

@actual-nh actual-nh added <Bug> This needs to be fixed <Crash / Freeze> Fatal bug that results in hangs or crashes. Items / Item Actions / Item Qualities Items and how they work and interact Items: Food / Vitamins Comestibles and drinks Mods Issues related to mods or modding Mechanics: Temperature Freezing, cooling, thawing, heating, etc. mechanics and removed Mods Issues related to mods or modding Items: Food / Vitamins Comestibles and drinks labels Aug 5, 2021
@hexagonrecursion
Copy link
Contributor

src/submap.h:309:24: runtime error: member call on null pointer of type 'submap'
    #0 0x45b0dec in maptile::find_field(int_id<field_type> const&) /home/user/Cataclysm-DDA/src/submap.h:309:24
    #1 0x448244c in maptile_field_intensity(maptile&, int_id<field_type>) /home/user/Cataclysm-DDA/src/game.cpp:1270:39
    #2 0x4481c64 in get_heat_radiation(tripoint const&, bool) /home/user/Cataclysm-DDA/src/game.cpp:1291:21
    #3 0x6ed2726 in weather_manager::get_temperature(tripoint const&) /home/user/Cataclysm-DDA/src/weather.cpp:994:21
    #4 0x4a94e72 in item::process_temperature_rot(float, tripoint const&, Character*, temperature_flag, float) /home/user/Cataclysm-DDA/src/item.cpp:9851:30
    #5 0x4aa5ec7 in item::process_internal(Character*, tripoint const&, float, temperature_flag, float) /home/user/Cataclysm-DDA/src/item.cpp:10771:13
    #6 0x4aa42fe in item::process(Character*, tripoint const&, float, temperature_flag, float) /home/user/Cataclysm-DDA/src/item.cpp:10663:12
    #7 0x529a817 in map::add_item(tripoint const&, item) /home/user/Cataclysm-DDA/src/map.cpp:4347:18
    #8 0x529a19d in map::add_item_or_charges(tripoint const&, item, bool)::$_52::operator()(tripoint const&) const /home/user/Cataclysm-DDA/src/map.cpp:4262:16
    #9 0x524a0d1 in map::add_item_or_charges(tripoint const&, item, bool) /home/user/Cataclysm-DDA/src/map.cpp:4290:16
    #10 0x528e166 in map::spawn_items(tripoint const&, std::vector<item, std::allocator<item> > const&) /home/user/Cataclysm-DDA/src/map.cpp:4147:20
    #11 0x54f9310 in map::put_items_from_loc(string_id<Item_spawn_data> const&, tripoint const&, time_point const&) /home/user/Cataclysm-DDA/src/mapgen.cpp:5902:12
    #12 0x54f5285 in map::place_items(string_id<Item_spawn_data> const&, int, tripoint const&, tripoint const&, bool, time_point const&, int, int) /home/user/Cataclysm-DDA/src/mapgen.cpp:5880:24
    #13 0x539b6cf in map::place_items(string_id<Item_spawn_data> const&, int, point const&, point const&, bool, time_point const&, int, int) /home/user/Cataclysm-DDA/src/map.h:1327:20
    #14 0x565f349 in jmapgen_item_group::apply(mapgendata const&, jmapgen_int const&, jmapgen_int const&) const /home/user/Cataclysm-DDA/src/mapgen.cpp:1912:19
    #15 0x54b6895 in jmapgen_objects::apply(mapgendata const&) const /home/user/Cataclysm-DDA/src/mapgen.cpp:3833:18
    #16 0x54b5b87 in jmapgen_objects::apply(mapgendata const&, point const&) const /home/user/Cataclysm-DDA/src/mapgen.cpp:3842:9
    #17 0x54fda1e in update_mapgen_function_json::update_map(mapgendata const&, point const&, bool) const /home/user/Cataclysm-DDA/src/mapgen.cpp:6968:13
    #18 0x54ff602 in get_changed_ids_from_update(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/user/Cataclysm-DDA/src/mapgen.cpp:7046:37
    #19 0x65affd3 in recipe::finalize() /home/user/Cataclysm-DDA/src/recipe.cpp:365:47
    #20 0x65ddb4f in recipe_dictionary::finalize_internal(std::map<string_id<recipe>, recipe, std::less<string_id<recipe> >, std::allocator<std::pair<string_id<recipe> const, recipe> > >&) /home/user/Cataclysm-DDA/src/recipe_dictionary.cpp:422:21
    #21 0x65ded94 in recipe_dictionary::finalize() /home/user/Cataclysm-DDA/src/recipe_dictionary.cpp:497:5
    #22 0x48a2181 in void std::__invoke_impl<void, void (*&)()>(std::__invoke_other, void (*&)()) /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/bits/invoke.h:60:14
    #23 0x48a2118 in std::enable_if<__and_<std::is_void<void>, std::__is_invocable<void (*&)()> >::value, void>::type std::__invoke_r<void, void (*&)()>(void (*&)()) /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/bits/invoke.h:153:7
    #24 0x48a1fc1 in std::_Function_handler<void (), void (*)()>::_M_invoke(std::_Any_data const&) /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/bits/std_function.h:291:9
    #25 0x344db0b in std::function<void ()>::operator()() const /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/bits/std_function.h:622:14
    #26 0x488a849 in DynamicDataLoader::finalize_loaded_data(loading_ui&) /home/user/Cataclysm-DDA/src/init.cpp:694:9
    #27 0x4472240 in game::load_world_modfiles(loading_ui&) /home/user/Cataclysm-DDA/src/game.cpp:2480:39
    #28 0x44711f6 in game::setup() /home/user/Cataclysm-DDA/src/game.cpp:600:5
    #29 0x52337ba in main_menu::new_character_tab() /home/user/Cataclysm-DDA/src/main_menu.cpp:856:28
    #30 0x5231100 in main_menu::opening_screen() /home/user/Cataclysm-DDA/src/main_menu.cpp:622:37
    #31 0x52189e9 in main /home/user/Cataclysm-DDA/src/main.cpp:704:23
    #32 0x73c9e699a1e1 in __libc_start_main (/lib64/libc.so.6+0x281e1)
    #33 0x2ff76fd in _start (/home/user/QubesIncoming/cdda-cpp/out/cataclysm-tiles+0x2ff76fd)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/submap.h:309:24 in 

@RenechCDDA
Copy link
Member

The given json no longer crashes the game as of c94dc03

@RenechCDDA
Copy link
Member

RenechCDDA commented Jul 1, 2023

I forgot to select the mod to load -_-

Here's the modern stack trace

The program has crashed.
See the log file for a stack trace.
CRASH LOG FILE: ./config/crash.log
VERSION: c94dc03
TYPE: Signal
MESSAGE: SIGSEGV: Segmentation fault
STACK TRACE:

#0
(dbghelp: debug_write_backtrace+0xb5@0,000,7FF,7F0,874,C85[cataclysm-tiles.exe+0x5e4,c85]),
#1
(dbghelp: log_crash+0x377@0,000,7FF,7F0,83A,757[cataclysm-tiles.exe+0x5aa,757]),
#2
(dbghelp: signal_handler+0x57@0,000,7FF,7F0,83A,CE7[cataclysm-tiles.exe+0x5aa,ce7]),
#3
(dbghelp: seh_filter_exe+0x178@0,000,7FF,7F1,D35,E20[cataclysm-tiles.exe+0x1,aa5,e20]),
#4
(dbghelp: __scrt_common_main_seh'::1'::filt$0+0x16@0,000,7FF,7F1,F60,082[cataclysm-tiles.exe+0x1,cd0,082]),
#5
(dbghelp: _C_specific_handler+0xa0@0,000,7FF,7F1,D06,BF4[cataclysm-tiles.exe+0x1,a76,bf4]),
#6
(dbghelp: _chkstk+0x11f@0,000,7FF,D37,2F2,47F[ntdll.dll+0xa2,47f]),
#7
(dbghelp: RtlRaiseException+0x484@0,000,7FF,D37,2A1,4F4[ntdll.dll+0x51,4f4]),
#8
(dbghelp: KiUserExceptionDispatcher+0x2e@0,000,7FF,D37,2F0,F8E[ntdll.dll+0xa0,f8e]),
#9
(dbghelp: maptile_field_intensity+0x17@0,000,7FF,7F0,8F9,EB7[cataclysm-tiles.exe+0x669,eb7]),
#10
(dbghelp: get_heat_radiation+0x284@0,000,7FF,7F0,8E4,304[cataclysm-tiles.exe+0x654,304]),
#11
(dbghelp: weather_manager::get_temperature+0xfa@0,000,7FF,7F0,E6C,10A[cataclysm-tiles.exe+0xbdc,10a]),
#12
(dbghelp: item::process_temperature_rot+0x99@0,000,7FF,7F1,008,B19[cataclysm-tiles.exe+0xd78,b19]),
#13
(dbghelp: item::process_internal+0xc60@0,000,7FF,7F1,007,BF0[cataclysm-tiles.exe+0xd77,bf0]),
#14
(dbghelp: map::add_item+0x19d@0,000,7FF,7F0,BF6,8AD[cataclysm-tiles.exe+0x966,8ad]),
#15
(dbghelp: <lambda_f1742153c434f707b6265f9e9456558f>::operator()+0x14e@0,000,7FF,7F0,BF4,21E[cataclysm-tiles.exe+0x964,21e]),
#16
(dbghelp: map::_add_item_or_charges+0x12a@0,000,7FF,7F0,BF5,34A[cataclysm-tiles.exe+0x965,34a]),
#17
(dbghelp: map::add_item_or_charges+0x4e@0,000,7FF,7F0,BF7,18E[cataclysm-tiles.exe+0x967,18e]),
#18
(dbghelp: map::place_items+0x4da@0,000,7FF,7F1,3A0,AAA[cataclysm-tiles.exe+0x1,110,aaa]),
#19
(dbghelp: jmapgen_item_group::apply+0xad@0,000,7FF,7F1,369,70D[cataclysm-tiles.exe+0x1,0d9,70d]),
#20
(dbghelp: jmapgen_objects::apply+0x13b@0,000,7FF,7F1,36A,7DB[cataclysm-tiles.exe+0x1,0da,7db]),
#21
(dbghelp: apply_mapgen_in_phases+0xe9@0,000,7FF,7F1,36E,E79[cataclysm-tiles.exe+0x1,0de,e79]),
#22
(dbghelp: update_mapgen_function_json::update_map+0xe2@0,000,7FF,7F1,3AC,492[cataclysm-tiles.exe+0x1,11c,492]),
#23
(dbghelp: get_changed_ids_from_update+0x18c@0,000,7FF,7F1,397,1DC[cataclysm-tiles.exe+0x1,107,1dc]),
#24
(dbghelp: calculate_all_blueprint_reqs+0xae3@0,000,7FF,7F1,115,C03[cataclysm-tiles.exe+0xe85,c03]),
#25
(dbghelp: recipe::finalize+0x48@0,000,7FF,7F1,117,BB8[cataclysm-tiles.exe+0xe87,bb8]),
#26
(dbghelp: recipe_dictionary::finalize_internal+0x1b@0,000,7FF,7F1,125,FBB[cataclysm-tiles.exe+0xe95,fbb]),
#27
(dbghelp: recipe_dictionary::finalize+0xa0@0,000,7FF,7F1,125,150[cataclysm-tiles.exe+0xe95,150]),
#28
(dbghelp: DynamicDataLoader::finalize_loaded_data+0x1,f89@0,000,7FF,7F1,557,119[cataclysm-tiles.exe+0x1,2c7,119]),
#29
(dbghelp: game::load_world_modfiles+0x614@0,000,7FF,7F0,8F7,884[cataclysm-tiles.exe+0x667,884]),
#30
(dbghelp: game::setup+0x206@0,000,7FF,7F0,916,886[cataclysm-tiles.exe+0x686,886]),
#31
(dbghelp: main_menu::new_character_tab+0x1,499@0,000,7FF,7F0,9CE,2E9[cataclysm-tiles.exe+0x73e,2e9]),
#32
(dbghelp: main_menu::opening_screen+0x2,02c@0,000,7FF,7F0,9D0,A1C[cataclysm-tiles.exe+0x740,a1c]),
#33
(dbghelp: WinMain+0xbe9@0,000,7FF,7F0,705,DB9[cataclysm-tiles.exe+0x475,db9]),
#34
(dbghelp: __scrt_common_main_seh+0x106@0,000,7FF,7F1,D03,82A[cataclysm-tiles.exe+0x1,a73,82a]),
#35
(dbghelp: BaseThreadInitThunk+0x14@0,000,7FF,D36,207,614[KERNEL32.DLL+0x17,614]),
#36
(dbghelp: RtlUserThreadStart+0x21@0,000,7FF,D37,2A2,6F1[ntdll.dll+0x52,6f1]),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bug> This needs to be fixed <Crash / Freeze> Fatal bug that results in hangs or crashes. Items / Item Actions / Item Qualities Items and how they work and interact Mechanics: Temperature Freezing, cooling, thawing, heating, etc. mechanics
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants