Source Code Project Mantis - FSSCP
View Issue Details
0002778FSSCPmultiplayerpublic2013-01-10 18:012020-11-01 10:37
Assigned ToFSCyborg 
PriorityurgentSeverityminorReproducibilityhave not tried
PlatformOSOS Version
Product Version3.6.15 
Target VersionFixed in Version 
Summary0002778: Assert on standalone resulting from divide by 0 caused by game_skill_level being out of range
DescriptionYea that's a mouthful but no idea how to state it better.

Had a standalone crash with an Assert(t_goal < delta_t) from approach() in aicode.cpp. Turs out the value of aa (as well as w_max) was -1.#INF000. This was eventually traced back to a set of divide by 0 due to Ai_info[Ships[objp->instance].ai_index].ai_turn_time_scale on line being -0.0 in ai_turn_towards_vector() line 1160. After some more digging the root of the problem was found in init_aip_from_class_and_profile() where the value was set incorrectly as game_skill_level was 222 (valid range is 0-4).

There are asserts for this all over the code except in 2 key areas: Reading from pilot file and sending/receiving multiplayer packets. The only way I can figure that this could happen is if the client who was the host had a corrupted pilot file with the 222 value and that got sent to the host.

So other then the obvious adding some code that checks the values sent and received and probably verifying after the read from the pilot file (I haven't checked the new pilot code) can you think of anything else that could have caused this or done to fix it?

Also probably should add a check before those divide by 0s.
TagsNo tags attached.
Attached Filespatch 2778_multimsg.patch (1,111) 2013-01-13 15:41

2013-01-10 20:07   
Do you know what version of FSO the client was running? i.e. is it the new or old pilot code that might be at fault?
2013-01-10 20:49   
Unfortunately as with most standalone issues I don't have any information client side outside of the pilot names.
2013-01-12 16:56   
Attached patch that should catch this and reset in multimsg. I'll put it up on the standalones for testing next time I update them.

This doesn't address the pilot file or the /0.
2013-01-24 08:48   
I suspect I've seen this issue in a slightly different form. I have a pilot which always crashes the options screen with an out of range value. Unfortunately I was busy fixing other bugs at the time so I didn't have the chance to figure out what caused it.
2013-02-01 23:03   
Well I took a look at it and I'm still not sure where the corruption client side is coming from. I think the patch in addition to patching init_aip_from_class_and_profile() with a sanity check would be a good solution so I'll commit that but leave this open so that I can take a better look at it when I'm better equipped to look at bugs.
2013-02-01 23:41   
Fix committed to trunk@9520.
2013-03-09 18:02   
Interesting I just got the warning for sending a packet from the host on one of the standalones. Skill level was 129. Since the receive packet check didn't trigger it seems like something is going wrong on the standalone itself to cause this issue.
2013-05-06 05:21   
Just had the Port stadalone go down with this warning so the skill level is still somehow getting corrupted. Runnin r9668
2020-11-01 10:36   
Need to investigate this one before year's end!!

Issue History
2013-01-10 18:01FUBAR-BDHRNew Issue
2013-01-10 20:07niffiwanNote Added: 0014630
2013-01-10 20:49FUBAR-BDHRNote Added: 0014631
2013-01-12 16:54FUBAR-BDHRFile Added: 2778_multimsg.patch
2013-01-12 16:56FUBAR-BDHRNote Added: 0014636
2013-01-13 15:41FUBAR-BDHRFile Deleted: 2778_multimsg.patch
2013-01-13 15:41FUBAR-BDHRFile Added: 2778_multimsg.patch
2013-01-23 01:54Echelon9Statusnew => code review
2013-01-24 08:48karajormaNote Added: 0014659
2013-02-01 23:03karajormaNote Added: 0014679
2013-02-01 23:41karajormaChangeset attached => fs2open trunk r9520
2013-02-01 23:41karajormaNote Added: 0014680
2013-02-01 23:41karajormaStatuscode review => resolved
2013-02-01 23:41karajormaResolutionopen => fixed
2013-02-01 23:42karajormaAssigned To => karajorma
2013-02-01 23:42karajormaStatusresolved => assigned
2013-03-09 18:02FUBAR-BDHRNote Added: 0014760
2013-05-06 05:21FUBAR-BDHRNote Added: 0015037
2013-12-03 04:43Echelon9CategoryAI => multiplayer
2020-11-01 10:36FSCyborgNote Added: 0017036
2020-11-01 10:37FSCyborgAssigned Tokarajorma => FSCyborg
2020-11-01 10:37FSCyborgPrioritynormal => urgent