Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: ralphmerridew [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.87
Fixed in: (no value)



Subject: Crash on call to attributes()
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1316476869-20559-226"
Content-Length: 0
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 266
Download (untitled) / with headers
text/plain 266b
Perl v5.12.2 MSWin32-x86-multi-thread MINGW32_NT-6.1 1.0.17(0.48/3/2) 2011/04-24 23:39 1686 Msys Sometimes, LibXML will crash when attributes() is called on a node. (In attached, set LIST_ATTRIBUTES to 0 and it runs fine. Set LIST_ATTRIBUTES to 1 and it crashes.)
Subject: test-xml-2.pl
MIME-Version: 1.0
Content-Type: application/octet-stream; name="test-xml-2.pl"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline; filename="test-xml-2.pl"
Content-Transfer-Encoding: base64
Content-Length: 553
Download test-xml-2.pl
text/x-perl 553b
#!/usr/bin/perl use strict; my $LIST_ATTRIBUTES = 1; sub dump_xml { my ($root, $depth) = @_; print $root, "\n"; printf ("%sName:%s hasAttr(%s) Attr(%s)\n", " "x$depth, $root->nodeName, $root->hasAttributes, (join (' ', $LIST_ATTRIBUTES ? $root->attributes() : ('skip')))); foreach my $kid ($root->childNodes()) { dump_xml ($kid, $depth + 1); } } use XML::LibXML; my $doc = new XML::LibXML->parse_string ('<?xml version="1.0"?><!DOCTYPE doc [ <!ENTITY nbsp "&#xa0;"> ]><doc></doc>'); dump_xml ($doc, 1);
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-20563-1316513313-1364.71076-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 592
Download (untitled) / with headers
text/plain 592b
Hi Ralph, On Mon Sep 19 20:01:10 2011, ralphmerridew@gmail.com wrote: Show quoted text
> Perl v5.12.2 MSWin32-x86-multi-thread > MINGW32_NT-6.1 1.0.17(0.48/3/2) 2011/04-24 23:39 1686 Msys > > Sometimes, LibXML will crash when attributes() is called on a node. > (In attached, set LIST_ATTRIBUTES to 0 and it runs fine. Set > LIST_ATTRIBUTES to 1 and it crashes.)
After investigating this problem, I realised it was exhibited in the C libxml2 as well, so I reported it here with a reproducing C program. https://bugzilla.gnome.org/show_bug.cgi?id=659564 Thanks for your report. Regards, -- Shlomi Fish
MIME-Version: 1.0
In-Reply-To: <rt-3.8.HEAD-20563-1316513313-1364.71076-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
X-RT-Interface: Web
References: <rt-3.8.HEAD-20563-1316513313-1364.71076-0-0 [...] rt.cpan.org>
Content-Type: multipart/mixed; boundary="----------=_1394229840-22709-2"
Message-ID: <rt-4.0.18-22709-1394229840-185.71076-0-0 [...] rt.cpan.org>
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 379
Download (untitled) / with headers
text/plain 379b
On Tue Sep 20 06:08:33 2011, SHLOMIF wrote: Show quoted text
> After investigating this problem, I realised it was exhibited in the C > libxml2 as well, so I reported it here with a reproducing C program. > > https://bugzilla.gnome.org/show_bug.cgi?id=659564
This is not a bug in libxml2. See my comment there and the attachment for a fix. I'll send a pull request with test cases later. Nick
MIME-Version: 1.0
Subject: rt71076.diff
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Type: application/octet-stream; name="rt71076.diff"
Content-Disposition: inline; filename="rt71076.diff"
Content-Transfer-Encoding: base64
Content-Length: 773
Download rt71076.diff
text/x-diff 773b
diff -r 597feb3908f5 LibXML.xs --- a/LibXML.xs Fri Feb 28 00:49:54 2014 +0100 +++ b/LibXML.xs Fri Mar 07 23:01:54 2014 +0100 @@ -4608,7 +4608,8 @@ int wantarray = GIMME_V; PPCODE: PERL_UNUSED_VAR(ix); - if ( self->type != XML_ATTRIBUTE_NODE ) { + if ( self->type != XML_ATTRIBUTE_NODE + && self->type != XML_DTD_NODE ) { attr = self->properties; while ( attr != NULL ) { if ( wantarray != G_SCALAR ) { @@ -4670,7 +4671,8 @@ hasAttributes( self ) xmlNodePtr self CODE: - if ( self->type == XML_ATTRIBUTE_NODE ) { + if ( self->type == XML_ATTRIBUTE_NODE + || self->type == XML_DTD_NODE ) { RETVAL = 0; } else {
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-22709-1394229840-185.71076-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-3.8.HEAD-20563-1316513313-1364.71076-0-0 [...] rt.cpan.org> <rt-4.0.18-22709-1394229840-185.71076-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-13044-1394733853-118.71076-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 639
Download (untitled) / with headers
text/plain 639b
On Fri Mar 07 17:04:00 2014, NWELLNHOF wrote: Show quoted text
> On Tue Sep 20 06:08:33 2011, SHLOMIF wrote:
> > After investigating this problem, I realised it was exhibited in the > > C > > libxml2 as well, so I reported it here with a reproducing C program. > > > > https://bugzilla.gnome.org/show_bug.cgi?id=659564
> > This is not a bug in libxml2. See my comment there and the attachment > for a fix. I'll send a pull request with test cases later. > > Nick
Thanks for the pull request and the investigation. This was merged into the bitbucket repo, and I'm going to resolve this bug and make a new release on CPAN soon. Regards, -- Shlomi Fish


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.