CleverRaven / Cataclysm-DDA

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

Segmentation Fault CTD when repairing using UPS-equipped tools #65643

Closed Spaceb0i closed 1 year ago

Spaceb0i commented 1 year ago

Describe the bug

Any time you repair something with a tool with the UPS conversion mod, it causing a crash to desktop and segmentation fault. This was tested both with a makeshift arc welder and a soldering iron, the former on a pipe and 1L engine, and the latter on a funnel. All of them caused the same CTD.

Attach save file

Massachusetts-trimmed.tar.gz 7zip claims "there are some data after the end of the payload data", not sure what this means but if that's some kind of save corruption it could be a problem (I doubt it, considering the rest of the game works fine).

Steps to reproduce

  1. Activate makeshift arc welder+1.
  2. Attempt to repair pipe.
  3. Observe a crash to desktop.

Expected behavior

I would expect the item to be repaired and no CTD to happen.

Screenshots

image Screenshot of repair screen taken immediately before crash.

Versions and configuration

OS: Windows

Additional context

crash.log debug.log I was initially on an older experimental build (version ea17d8e) which had the same issues.

Spaceb0i commented 1 year ago

Source of the bug found. In line 2333 of activity_handlers.cpp there is the following line: ammo_name = item::nname( used_tool->ammo_current() ); It gives the following reason for why there was an unhandled exception: Item_factory::find_template(...)->ammo._Mypair._Myval2 was nullptr image As for how to fix it, I have no idea yet.

Spaceb0i commented 1 year ago

Final advice for the night: Take a look at lines 10491 to 10525 of item.cpp, where ammo_data() and ammo_current() are defined. I have a feeling they don't play nicely with the UPS, despite ammo_data()'s apparent attempt to accommodate it.

Spaceb0i commented 1 year ago

Oops forgot to close this, it's fixed