After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 326473 - xmlOutputBufferClose() crashes
xmlOutputBufferClose() crashes
Status: RESOLVED NOTABUG
Product: libxml2
Classification: Platform
Component: general
2.6.20
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2006-01-10 15:05 UTC by Marko Lindqvist
Modified: 2006-01-10 16:17 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Marko Lindqvist 2006-01-10 15:05:46 UTC
Sometimes (less than one in thousand) call to xmlOutputBufferClose() crashes. We use it like this:

m_enHandler  = xmlGetCharEncodingHandler(XML_CHAR_ENCODING_8859_1);
m_xml_buffer = xmlOutputBufferCreateIO(Callback, CloseCallback, 0, m_enHandler);
m_xml_buffer->context = (void*)&sPrintableEncodedAsciiText;
// ... m_xmlString = xmlParseDoc()
// ... m_result = xsltApplyStylesheet(xxx, m_xmlString, 0);
// ... xsltSaveResultTo(m_xml_buffer, m_result, ...);
// ... xsltCleanupGlobals();
// ... xmlCleanupParser();
xmlOutputBufferClose(m_xml_buffer);

Backtrace:
(gdb) bt full
  • #0 kill
    from /lib/libc.so.6
  • #1 pthread_kill
    from /lib/libpthread.so.0
  • #2 raise
    from /lib/libpthread.so.0
  • #3 raise
    from /lib/libc.so.6
  • #4 abort
    from /lib/libc.so.6
  • #5 __libc_message
    from /lib/libc.so.6
  • #6 malloc_printerr
    from /lib/libc.so.6
  • #7 _int_free
    from /lib/libc.so.6
  • #8 free
    from /lib/libc.so.6
  • #9 xmlCharEncCloseFunc__internal_alias
    at encoding.c line 2092
  • #10 xmlOutputBufferClose__internal_alias
    at xmlIO.c line 2136

Comment 1 Daniel Veillard 2006-01-10 16:13:55 UTC
1/ check with the latest release
2/ no idea what is at line 2092 in your version of encoding.c
3/ the free() can come from a number of places
4/ you may hit reentrancy problems in threaded apps
5/ your code may also so something stupid somewhere else generating this

There is no obvious error in libxml2 code.
There is no way for me to reproduce your problem
Minimize and reproduce and then I will fix it if it's libxml2 fault !

Daniel 
Comment 2 Daniel Veillard 2006-01-10 16:17:41 UTC
Oh yeah You are doing something stupid !!!

xmlCleanupParser();

would you mind checking the documentation for this function ??? Why are you
calling this while you are not done with libxml2 usage ? Especially when doing
this thousands of time.

NOTABUG !

Daniel