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()
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
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);
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
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
Subject: rt71076.diff
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 {
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.