Skip Menu |
 

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

Report information
The Basics
Id: 71345
Status: open
Priority: 0/
Queue: XML-LibXSLT

People
Owner: Nobody in particular
Requestors: fschlich [...] zedat.fu-berlin.de
Cc:
AdminCc:

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



Subject: segfault in free()
Download (untitled) / with headers
text/plain 462b
Hi, I'm forwarding http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=568382 "I'm now becoming convinced that this is a memory management issue between Perl and libxslt - I think that both are trying to free the same objects..." / "I'm guessing that this means it's possibly Perl's garbage collection interfering?" Of the attached samples, 568382a.pl runs ok, whereas 568382a1.pl with only minimal changes ("push @keep, @_;" removed) causes a segfault. Florian
Subject: 568382a.pl
Download 568382a.pl
text/x-perl 922b
#!/usr/bin/perl -w use strict; use warnings; use XML::LibXSLT; use XML::LibXML; my $xslt = XML::LibXSLT->new(); my $ext_uri = "urn:local"; my @keep; XML::LibXSLT->register_function($ext_uri, "uc", sub { push @keep, @_; return uc shift; } ); my $stylesheet = $xslt->parse_stylesheet(XML::LibXML->load_xml(string => <<'EOF')); <xsl:stylesheet version="1.0" extension-element-prefixes="exsl local" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:local="urn:local"> <xsl:template match="/"> <xsl:variable name="foo"><foo a="foo"/></xsl:variable> <bar><xsl:value-of select="local:uc(exsl:node-set($foo)//@a)"/></bar> </xsl:template> </xsl:stylesheet> EOF my $input = XML::LibXML->load_xml(string => "<input/>"); print $stylesheet->transform($input)->toString; # Next line crashes Perl @keep = undef;
Subject: 568382a1.pl
Download 568382a1.pl
text/x-perl 906b
#!/usr/bin/perl -w use strict; use warnings; use XML::LibXSLT; use XML::LibXML; my $xslt = XML::LibXSLT->new(); my $ext_uri = "urn:local"; my @keep; XML::LibXSLT->register_function($ext_uri, "uc", sub { return uc shift; } ); my $stylesheet = $xslt->parse_stylesheet(XML::LibXML->load_xml(string => <<'EOF')); <xsl:stylesheet version="1.0" extension-element-prefixes="exsl local" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:local="urn:local"> <xsl:template match="/"> <xsl:variable name="foo"><foo a="foo"/></xsl:variable> <bar><xsl:value-of select="local:uc(exsl:node-set($foo)//@a)"/></bar> </xsl:template> </xsl:stylesheet> EOF my $input = XML::LibXML->load_xml(string => "<input/>"); print $stylesheet->transform($input)->toString; # Next line crashes Perl @keep = undef;
From: fschlich [...] zedat.fu-berlin.de
Download (untitled) / with headers
text/plain 235b
Show quoted text
> Of the attached samples, 568382a.pl runs ok, whereas 568382a1.pl with > only minimal changes ("push @keep, @_;" removed) causes a segfault.
perhaps interestingly, with recently-released XML::LibXSLT 1.72, both examples now segfault
Download (untitled) / with headers
text/plain 162b
I've written a fix for this here: https://bitbucket.org/timbrody/perl-xml-libxslt/changeset/95fe5c0be0ae See the commit log for what I think caused the segfault.
Download (untitled) / with headers
text/plain 752b
Hi Tim, On Fri Oct 28 10:56:46 2011, TIMBRODY wrote: Show quoted text
> I've written a fix for this here: > https://bitbucket.org/timbrody/perl-xml-libxslt/changeset/95fe5c0be0ae > > See the commit log for what I think caused the segfault.
Many thanks for the fix! You're awesome. Some notes, however for next time: 1. The fix should include a description of the modifications in the "Changes" file. 2. The newly added files (the t/*.t in our case) should be added to the MANIFEST. 3. The test assertions should include a blurb. 4. The test assertions should include a leading Test-Count "# TEST" annotation. I will fix all those myself this time, but please pay attention next time. Maybe I'll add all of those to a HACKING document. 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.