The International Simutrans Forum

Simutrans Extended => Simutrans-Extended bug reports => Simutrans-Extended development => Simutrans-Extended closed bug reports => Topic started by: Phystam on May 31, 2021, 09:21:03 AM

Title: (#514be03) crash just after loading a save game
Post by: Phystam on May 31, 2021, 09:21:03 AM
Hi,
I don't know whether it is a related issue: https://forum.simutrans.com/index.php/topic,20926.0.html (https://forum.simutrans.com/index.php/topic,20926.0.html)
I loaded an old save game which was saved before incorporation of PJMack's improvement patch, and saved it with the latest version. (#514be03)
Just after loading the new save game, the game showed a fatal error and crashed.
(https://media.discordapp.net/attachments/514739526330220547/848852863337496576/unknown.png)

Try this: https://www.dropbox.com/s/w0qpuch1jp5zvgh/PHNS-Karafuto-2nd3.sve?dl=0 (https://www.dropbox.com/s/w0qpuch1jp5zvgh/PHNS-Karafuto-2nd3.sve?dl=0)



I misplaced this report on the wrong board. Can someone move this to "not closed" bug report? <- I could.  forget this~~
Title: Re: (#514be03) crash just after loading a save game
Post by: Phystam on May 31, 2021, 06:28:47 PM
double post!
I updated the pakset and the Extended(#51a0f3c), then it works fine for a while. But after some time, I got another crash without a fatal error.
I made a save game that can reproduce the crash just after loading: https://www.dropbox.com/s/theul150908c9bo/PHNS-Karafuto-2nd6.sve?dl=0 (https://www.dropbox.com/s/theul150908c9bo/PHNS-Karafuto-2nd6.sve?dl=0)

GDB shows this message. Probably divided by zero or something?
(https://media.discordapp.net/attachments/514739526330220547/848986260688994314/unknown.png)
Title: Re: (#514be03) crash just after loading a save game
Post by: PJMack on June 01, 2021, 12:47:08 AM
And this is another embarrassing mistake I have to apologize for...  I submitted a crash prevention fix.

What is happening is that during congestion percentage calculation, the combined_actual multiplied by 100u is greater than 2^32 resulting in an overflow and resulting in 2^32-100.  This, upon conversion to sint32 results in -100, hence the division by zero.  The fast fix was to ignore any congestion percentages less than zero.
Title: Re: (#514be03) crash just after loading a save game
Post by: Phystam on June 01, 2021, 06:48:24 AM
Thank you for your quick fix!