matrakim / opencollada

Automatically exported from code.google.com/p/opencollada
0 stars 0 forks source link

xmlCleanupParser used incorrectly, can cause crashes #184

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
In GeneratedSaxParser/src/GeneratedSaxParserLibxmlSaxParser.cpp, 
xmlCleanupParser is called in the destructor of LibxmlSaxParser. 
xmlCleanupParser is not meant to clean up after one instance of parsing.

As per http://xmlsoft.org/html/libxml-parser.html#xmlCleanupParser , it should 
be called either right before exit, which OpenCOLLADA can't guarantee, or not 
at all.

This call can cause crashes in seemingly unrelated, pthread-using code. We 
found this issue in Sirikata as it caused crashes in some PulseAudio code 
(which we were using indirectly via SDL). I tracked it down to this issue via 
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=500696#15 .

I think this line should just be removed. We're using a patched version that 
just removes the line in Sirikata and it seems to be fine.

Original issue reported on code.google.com by echesl...@gmail.com on 31 Jan 2012 at 7:14

GoogleCodeExporter commented 8 years ago
I concur and second the bugreport.

We are still using the FCollada library in one of our projects. As far as I see 
the history of that issue goes back to FCollada < 3.04 where xmlCleanupParser() 
is incorrectly? called in FArchiveXML::ImportFile() and 
FArchiveXML::ImportFileFromMemory().

That was then fixed in FCollada in between 3.05b and 3.1.1, where the call was 
completely removed.

I'd guess the same should be applied to opencollada?

Note that after a xmlCleanupParser all callbacks are reset. So if a user 
actually sets the callbacks to his own ones, they will only be used for the 
first time OpenCollada opens a file.

So that's another symptom of the underlying bug here.

Original comment by Luke1...@gmx.de on 25 Jul 2013 at 9:02