Segfault when moving entity with invalid terrain mod

Bug #291328 reported by Erik Ogenvik
2
Affects Status Importance Assigned to Milestone
Cyphesis
Fix Committed
Undecided
Unassigned

Bug Description

A segfault occurs when an entity which has a terrainmod with incorrect data is moved. The fix is either to make Mercator::Terrain::removeMod check for null references, or to do that check in cyphesis.

Overall we need however to make sure that both the clients and the server knows how to parse terrain mods properly (the terrain mod in question, a level mod, is properly parsed in Ember). The first step would just to write down how terrain mods should be transferred. And then see how much parsing functionality we can push into lower level libs.
The bt (along with some log output):
2008-10-31 01:29:51 ERROR LevelTerrainMod defined with incorrect shape data
2008-10-31 01:29:51 ERROR Terrain Modifier could not be parsed!

Program received signal SIGSEGV, Segmentation fault.
Mercator::Terrain::removeMod (this=0x149f2b0, mod=0x0) at ../../Mercator/Terrain.cpp:392
392 WFMath::AxisBox<2> mod_box = mod->bbox();
(gdb) bt
#0 Mercator::Terrain::removeMod (this=0x149f2b0, mod=0x0) at ../../Mercator/Terrain.cpp:392
#1 0x00000000004c053a in TerrainModProperty::move (this=0x818f9a0, owner=<value optimized out>, newPos=@0x7fff52655450)
    at ../../rulesets/TerrainModProperty.cpp:172
#2 0x000000000043cdad in terrainmod_moveHandler (e=0x65daa10, op=@0x70cec30, res=<value optimized out>)
    at ../../server/CorePropertyManager.cpp:201
#3 0x00000000004cbb6b in Entity::operation (this=0x65daa10, op=@0x70cec30, res=@0x7fff52655580) at ../../rulesets/Entity.cpp:384
#4 0x00000000004278b4 in WorldRouter::deliverTo (this=0x7fff52655bf0, op=@0x70cec30, ent=@0x65daa10)
    at ../../server/WorldRouter.cpp:430
#5 0x0000000000427f1a in WorldRouter::operation (this=0x7fff52655bf0, op=@0x70cec30, from=@0x65daa10)
    at ../../server/WorldRouter.cpp:487
#6 0x0000000000428539 in WorldRouter::idle (this=0x7fff52655bf0, sec=1225413118, usec=931022) at ../../server/WorldRouter.cpp:572
#7 0x000000000046fc0a in CommServer::idle (this=0x7fff52655d60) at ../../server/CommServer.cpp:93
#8 0x000000000046fcb5 in CommServer::poll (this=0x7fff52655d60) at ../../server/CommServer.cpp:126
#9 0x000000000047473d in main (argc=1, argv=0x7fff526562a8) at ../../server/server.cpp:330

Revision history for this message
Erik Ogenvik (erik-ogenvik) wrote :

The same thing happens when an entity with an invalid terrainmod is removed.

Revision history for this message
Erik Ogenvik (erik-ogenvik) wrote :

I think this should have been fixed by merging in my terrain mod changes.

Revision history for this message
Al Riddoch (alriddoch) wrote :

It's a bit tricky for me to be entirely sure this has gone away, so I aim to try and implement unit tests to cover this case, and reproduce if possible. I'll update the bug once I've done that.

Revision history for this message
Erik Ogenvik (erik-ogenvik) wrote :

This bug haven't resurfaced in five years; marking it as fixed.

Changed in cyphesis:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.