[xsl] Segfault shutting down exslt/functions (proposed patch)

Subject: [xsl] Segfault shutting down exslt/functions (proposed patch)
From: Stephan Suerken <stephan.suerken@xxxxxxxx>
Date: Wed, 25 Apr 2007 12:19:34 +0200
Hi,

[ this may be (a cause to re-open) http://bugzilla.gnome.org/show_bug.cgi?id=378766 ]

running a xsl transformation w/ the attached files yields this segfault:

---
xsltproc -v xsl.xsl xml.xml
(snip)
Shutting down module : http://exslt.org/functions
Segmentation fault
---
(gdb) run xsl.xsl xml.xml
Starting program: /usr/bin/xsltproc xsl.xsl xml.xml
Failed to read a valid object file image from memory.

Program received signal SIGSEGV, Segmentation fault.
0xb7cdb9b9 in free () from /lib/tls/libc.so.6
(gdb) bt
#0  0xb7cdb9b9 in free () from /lib/tls/libc.so.6
#1  0xb7f0f1bc in xsltFreeDocumentKeys (idoc=0x81fcb40) at keys.c:154
#2  0xb7f22876 in xsltFreeTransformContext (ctxt=0x81c4168) at transform.c:380
#3  0x08049a69 in xsltProcess (doc=0x81c4348, cur=0x8058778, filename=0xbfce5a55 "xml.xml") at xsltproc.c:411
#4  0x0804a37c in main (argc=3, argv=0xbfce4604) at xsltproc.c:854
#5  0xb7c8aea8 in __libc_start_main () from /lib/tls/libc.so.6
#6  0x080492d1 in _start () at ../sysdeps/i386/elf/start.S:119
---

This applies at least to versions 1.1.19, 1.1.20 and an svn co of
today (Apr 25).

The provided patch prevents the segfault; however, maybe someone
can check if this is the correct way to fix this.

It would also be nice if s.o. could point me to the part(s) in the
stylesheet actually provoking the bug -- I meekly failed minimising
it due to a lack of stylesheet knowledge ;(.

Thanks,

Stephan

P.S.: "Attached" files: patch, xsl, xml:

http://tmp.stephan-suerken.de/libxslt-segfault/libxslt.patch
http://tmp.stephan-suerken.de/libxslt-segfault/xsl.xsl
http://tmp.stephan-suerken.de/libxslt-segfault/xml.xml

-- 
Stephan Suerken <stephan.suerken@xxxxxxxx>
Phone: +49.721.913744-393

1&1 Internet AG, Karlsruhe

Current Thread