Skip Menu |

This queue is for tickets about the XML-LibXML CPAN distribution.

Report information
The Basics
Id: 136
Status: resolved
Priority: 0/
Queue: XML-LibXML

People
Owner: Nobody in particular
Requestors: adam.lounds [...] bbc.co.uk
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.31
Fixed in: (no value)



Subject: segfault with xml::lang/cloneNode
--code-- #!/usr/bin/perl -w use strict; use XML::LibXML; my $xml_coredump = '<Foo xml:lang="en-GB"/>'; my $doc = XML::LibXML->new()->$parser-> parse_string($xml_coredump)->getDocumentElement; my $foo = $doc->cloneNode(1); print "cloned OK!\n"; # segfaults before this --code-- segfaults. Making the XML more valid (with doctype etc) makes no difference, and someone *did* ask for short code :-) gdb output: --Starting program: /usr/bin/perl ./libxml_coredump.pl --Program received signal SIGSEGV, Segmentation fault. --xmlSearchNs (doc=0x0, node=0x819e470, nameSpace=0x819e5b8 "xml") at tree.c:4023 --4023 tree.c: No such file or directory. (passing a null doc?) Works fine if I cloneNode(0), or leave out the xml:lang attribute. Thanks, -- Adam
From: adam
[guest - Wed Jan 16 08:31:12 2002]: note that the $xml_coredump line is Foo xml:lang="en-GB" - do a "view source" to see the actual code - angle brackets didn't get escaped properly :-( Also note that it coredumps for xml:space or xml:bar as well, so it may be that the xml namespace is broken? Thx, -- Adam
From: adam
This is a bug in libxml2 itself, not XML::LibXML. Patch has been accepted by libxml2 maintainer: *** tree.c Mon Jan 21 15:22:47 2002 --- tree_fix.c Mon Jan 21 15:22:58 2002 *************** *** 4018,4027 **** --- 4018,4028 ---- xmlNsPtr cur; if (node == NULL) return(NULL); if ((nameSpace != NULL) && (xmlStrEqual(nameSpace, (const xmlChar *)"xml"))) { + if (doc == NULL) return(NULL); if (doc->oldNs == NULL) { /* * Allocate a new Namespace and fill the fields. */ doc->oldNs = (xmlNsPtr) xmlMalloc(sizeof(xmlNs));
Cool. Bug closed. [guest - Mon Jan 21 10:32:49 2002]: Show quoted text
> This is a bug in libxml2 itself, not XML::LibXML. Patch has been > accepted by libxml2 > maintainer: > > *** tree.c Mon Jan 21 15:22:47 2002 > --- tree_fix.c Mon Jan 21 15:22:58 > 2002 > *************** > *** 4018,4027 **** > --- 4018,4028 ---- > xmlNsPtr cur; > > if > (node == NULL) return(NULL); > if ((nameSpace != NULL) && > (xmlStrEqual(nameSpace, > (const xmlChar *)"xml"))) { > + if (doc == NULL) return(NULL); > if (doc->oldNs == NULL) > { > /* > * Allocate a new Namespace and fill the fields. > */ > doc->oldNs = (xmlNsPtr) > xmlMalloc(sizeof(xmlNs));