yangqiaosheng / libcitygml

Automatically exported from code.google.com/p/libcitygml
GNU Lesser General Public License v2.1
0 stars 0 forks source link

Crash loading a file with a surface inside an element that is not handled by libcitygml #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When loading the attached file, libcitygml crashes in CityModel::load when 
doing:
delete handler;

The delete triggers ~CityGMLHandler which iterates _geometries and deletes each 
of them. The problem is that _geometries contains previously deleted objects 
which are now filled with garbage and crash when deleted a second time.

_geometries contains deleted objects because with the given file, when 
encountering an end tag for surfaceMember or TriangulatedSurface the following 
happen:
1. _currentCityObject is NULL: it was never initialized because the 
WaterSurface parent of the surfaceMember is not handled by libcitygml so no 
_currentCityObject is created for it
2. the else branch of the if is taken, so _currentGeometry is deleted but 
remains in _geometries

Attached patch always does the removal from _geometries; it works for me but 
I'm not sure it's the best solution.

All this was tested and investigated with the current SVN head.

Original issue reported on code.google.com by iacobcatalin@gmail.com on 24 Jan 2012 at 5:09

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the report & patch. Now Fixed in Revision 128.

Original comment by jpouder...@gmail.com on 7 Feb 2012 at 10:05