I'm migrating an app to the latest Debian and I get a strange server error when validating XML against a XSD
use strict;
use feature qw( :5.10.0 );
use XML::LibXML;
my $xsd = q{
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="shiporder">
<xs:complexType>
<xs:sequence>
<xs:element name="orderperson" type="xs:string"/>
<xs:element name="shipto">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="orderid" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>
};
my $soap=q{
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<shiporder
orderid="889923"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="shiporder.xsd">
<orderperson>John Smith</orderperson>
<shipto>
<name>Ola Nordmann</name>
</shipto>
</shiporder>
</soap:Body>
</soap:Envelope>
};
my $xmlparser = XML::LibXML->new();
my $doc = $xmlparser->parse_string($soap);
my $nodelist = $doc->getElementsByTagNameNS('http://schemas.xmlsoap.org/soap/envelope/', 'Body');
say $nodelist->[0]->toString();
XML::LibXML::Schema->new(string => $xsd)->validate($nodelist->[0]);
which causes
* glibc detected perl: free(): invalid pointer: 0x0000000001cca220 ** ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x76d76)[0x7fa0edd5fd76] /usr/lib/perl5/auto/XML/LibXML/LibXML.so(PmmREFCNT_dec+0xa3)[0x7fa0ed27c543] /usr/lib/perl5/auto/XML/LibXML/LibXML.so(XS_XML_LibXML_Node_DESTROY+0xeb)[0x7fa0ed260a4b] /usr/lib/libperl.so.5.14(Perl_pp_entersub+0x58c)[0x7fa0ee7ce70c] /usr/lib/libperl.so.5.14(Perl_runops_standard+0x16)[0x7fa0ee7c5ce6] /usr/lib/libperl.so.5.14(Perl_call_sv+0x45b)[0x7fa0ee7619db] /usr/lib/libperl.so.5.14(Perl_sv_clear+0x559)[0x7fa0ee7d4bd9] /usr/lib/libperl.so.5.14(Perl_sv_free2+0x52)[0x7fa0ee7d5292] /usr/lib/libperl.so.5.14(Perl_leave_scope+0x122f)[0x7fa0ee7fccef] /usr/lib/libperl.so.5.14(Perl_pp_leave+0xf2)[0x7fa0ee7cb112] /usr/lib/libperl.so.5.14(Perl_runops_standard+0x16)[0x7fa0ee7c5ce6] /usr/lib/libperl.so.5.14(perl_run+0x3a5)[0x7fa0ee767815] perl(main+0x149)[0x400f89] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7fa0edd07ead] perl[0x400fc1] ======= Memory map: ======== 00400000-00402000 r-xp 00000000 08:01 137813 /usr/bin/perl
and so on
I think it is failing when trying to free the memory allocated. I've tried cloning the objects but nothing seems to stop it. This is failing on a clean install of wheezy and jessie