programmer’s nightmare is a coredump in malloc

Yesterday I updated libxml2 and xsltproc from CVS and got a coredump. I am very scared because I can't produce a test case and I think that the problem is on libxml's side.

Fortunately, I found a workaround at least. In the file "xpath.c" find the code fragment:

#ifdef LIBXML_PATTERN_ENABLED
#define XPATH_STREAMING
#endif

Change this code to:

#ifdef LIBXML_PATTERN_ENABLED
#define XPATH_STREAMING
#undef XPATH_STREAMING
#endif

Streaming is probably a good idea, but I'd better wait till the core for it is debugged well.

And I ought to write to mailing list and ask to make a switch for the "configure" script. It's not very good to edit code after each CVS update.

6 May 2005, update

I've wrote to the libxml mailing list, and a patch appeared in CVS. Here is what fixed the problem:

$ diff xpath.c xpath.c.r1.288 
11303c11303
< namespaces = xmlMalloc(2 * (ctxt->nsNr + 1) * sizeof(xmlChar*));
---
> namespaces = xmlMalloc(2 * (ctxt->nsNr + 1));
Categories: Generative XML

Updated: