Segfault (New Derivative Model)

Find any bugs in Vega Strike? See if someone has already found it, or report them here!
Post Reply
shadow_slicer
Merchant
Merchant
Posts: 47
Joined: Sat Jul 28, 2007 4:00 am

Segfault (New Derivative Model)

Post by shadow_slicer »

The past week the svn VS has been crashing on my Ubuntu system when I launch from a base or planet. It would always crash when csOPCODEcollider::Collide was called from Unit::InsideCollideTree with this set to NULL. This function does not check to ensure that the colliders it receives from the collTree function are not NULL. The collider for one of the units (a 'Derivative') was NULL. This collider was returned from the collTree function which returned NULL because the radius for this unit was set to 0.

The code hasn't been touched in a while, so I thought the actual problem was likely to be in the data. Since the 'Derivative' model has been recently replaced, I suspect there is something wrong with the bfxm file. I checked and the Derivative's bfxm file was named Derivative.bfxm, but was listed in units.csv as derivative.bfxm. After changing the name of the bfxm file, there was no crash (and Unit::InsideCollideTree was called significantly less often).

Recommendation:
1. Change derivative's filename to derivative.bfxm (note that this was the name of the original model's bfxm file, and we should keep this name to prevent possible save corruption)
2. Add extra checks in Unit::InsideCollideTree to handle data corruption more gracefully.
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Post by loki1950 »

Good catch shadow_slicer it's still amazes me how many capitalization errors we still have :roll:

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
pyramid
Expert Mercenary
Expert Mercenary
Posts: 988
Joined: Thu Jun 15, 2006 1:02 am
Location: Somewhere in the vastness of space
Contact:

Post by pyramid »

Indeed, units.csv had the wrong capitalization. My fault. It is corrected in the latest svn 12405. Thanks for spotting this.
shadow_slicer
Merchant
Merchant
Posts: 47
Joined: Sat Jul 28, 2007 4:00 am

Post by shadow_slicer »

No, changing units.csv is not the best solution. If you just change units.csv, that will break save game compatibility.
If a player already owns a derivative, then VS would load the unit from their serialized_xml folder. The files in there will still reference the old mesh name derivative.bfxm. Its likely this would still cause a crash in that case. I think it would be cleaner to just rename the actual Derivative.bfxm file in the data/units/Derivative directory.
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Post by loki1950 »

But that does not follow our convention :wink: the object to to make all of the entries agree and i don't think if you are playing the SVN hacking the save to agree is that hard :)

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
Post Reply