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

Crash during vehicle renewal #1127

Closed
AaronVanGeffen opened this issue Aug 29, 2021 · 3 comments · Fixed by #1138
Closed

Crash during vehicle renewal #1127

AaronVanGeffen opened this issue Aug 29, 2021 · 3 comments · Fixed by #1138
Labels
bug Something isn't working

Comments

@AaronVanGeffen
Copy link
Member

Version information:

  • Platform: Linux
  • Version: 21.08+
  • Build/commit: d793467

Describe the bug
Game crashes when applying vehicle renewal cheat

To Reproduce
Steps to reproduce the behaviour:

  1. Open this save: Desert Delirium 1920f.SV5.zip
  2. Open the cheats window, vehicles tab
  3. Click the 'full renewal' cheat

Error

Process 4128 stopped
* thread #1, name = 'openloco', stop reason = signal SIGSEGV: invalid address (fault address: 0x3a)
    frame #0: 0x0123f5bf openloco`OpenLoco::Vehicles::VehicleBase::nextVehicleComponent(this=0x00000000) at Vehicle.cpp:41:53
   38       VehicleBase* VehicleBase::nextVehicleComponent()
   39       {
   40           auto* veh = reinterpret_cast<VehicleCommon*>(this);
-> 41           return EntityManager::get<VehicleBase>(veh->next_car_id);
   42       }
   43  
   44       TransportMode VehicleBase::getTransportMode() const

Backtrace

* thread #1, name = 'openloco', stop reason = signal SIGSEGV: invalid address (fault address: 0x3a)
  * frame #0: 0x0123f5bf openloco`OpenLoco::Vehicles::VehicleBase::nextVehicleComponent(this=0x00000000) at Vehicle.cpp:41:53
    frame #1: 0x01178568 openloco`OpenLoco::Vehicles::Car::CarComponentIter::CarComponentIter(this=0xffffced0, carComponent=0xffffced0) at Vehicle.h:627:74
    frame #2: 0x011786d1 openloco`OpenLoco::Vehicles::Car::begin(this=0xffffced0) const at Vehicle.h:681:41
    frame #3: 0x0119b799 openloco`OpenLoco::GameCommands::Cheats::vehicleReliability(newReliablity=100) at Cheat.cpp:169:46
    frame #4: 0x0119b8c9 openloco`OpenLoco::GameCommands::cheat(command=vehicleReliability, param1=100, param2=0, param3=0) at Cheat.cpp:202:50
    frame #5: 0x0119b907 openloco`OpenLoco::GameCommands::cheat(regs=0xffffcfd4) at Cheat.cpp:213:25
    frame #6: 0x0119c261 openloco`OpenLoco::GameCommands::callGameCommandFunction(command=81, regs=0xffffcfd4) at GameCommands.cpp:216:39
    frame #7: 0x0119c336 openloco`OpenLoco::GameCommands::loc_4313C6(esi=81, regs=0xffffd0a0) at GameCommands.cpp:234:32
    frame #8: 0x0119c07a openloco`OpenLoco::GameCommands::doCommand(command=cheat, regs=0xffffd0a0) at GameCommands.cpp:175:30
    frame #9: 0x01265a96 openloco`OpenLoco::GameCommands::do_81(command=vehicleReliability, param1=100, param2=0, param3=0) at GameCommands.h:1562:39
    frame #10: 0x0126548d openloco`OpenLoco::Ui::Windows::Cheats::Vehicles::onMouseUp(self=0x011392e4, widgetIndex='\n') at Cheats.cpp:502:40
    frame #11: 0x0125c023 openloco`OpenLoco::Ui::Window::callOnMouseUp(this=0x011392e4, widgetIndex='\n') at Window.cpp:1146:36
    frame #12: 0x011aeee1 openloco`OpenLoco::Input::stateWidgetPressed(button=leftReleased, x=139, y=113, window=0x011392e4, widget=0x0148be00, widgetIndex='\n') at MouseInput.cpp:1505:38
    frame #13: 0x011abe1b openloco`OpenLoco::Input::handleMouse(x=139, y=113, button=leftReleased) at MouseInput.cpp:436:35
    frame #14: 0x0121672b openloco`OpenLoco::Ui::handleInput() at Ui.cpp:1143:35
    frame #15: 0x011e42aa openloco`OpenLoco::sub_431695(var_F253A0=1) at OpenLoco.cpp:496:28
    frame #16: 0x011e4c29 openloco`OpenLoco::tick() at OpenLoco.cpp:771:31
    frame #17: 0x011e5c4a openloco`OpenLoco::variableUpdate() at OpenLoco.cpp:1067:17
    frame #18: 0x011e5e52 openloco`OpenLoco::update() at OpenLoco.cpp:1106:27
    frame #19: 0x011e5eb2 openloco`OpenLoco::run() at OpenLoco.cpp:1145:19
    frame #20: 0x011e5fbb openloco`OpenLoco::main() at OpenLoco.cpp:1180:20
    frame #21: 0x011f7663 openloco`main(argc=1, argv=0xffffd534) at Platform.Posix.cpp:27:19
    frame #22: 0xf78b2a0d libc.so.6`__libc_start_main + 237
    frame #23: 0x0116a125 openloco`_start + 53
@AaronVanGeffen AaronVanGeffen added the bug Something isn't working label Aug 29, 2021
@duncanspumpkin
Copy link
Contributor

Something is saving the entity id as a signed value

@AaronVanGeffen
Copy link
Member Author

This is also happening on v21.05 and v21.07 with the same save. Not sure if it would have occurred had the game been played on those versions. If I understand you correctly, the data may have been corrupted by effectively dropping the highest bit.

@duncanspumpkin
Copy link
Contributor

I tested this save and i cant reproduce. But it looks really like a sign extension of something that shouldnt be a signed. I'll investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants