File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed
Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -453,8 +453,9 @@ sub build_tree_xml_parser {
453453sub new_xml_parser {
454454 my ($self ) = @_ ;
455455
456- my $xp = XML::Parser-> new(Style => ' Tree' , @{$self -> {opt }-> {parseropts }});
457- $xp -> setHandlers(ExternEnt => sub {return ' ' });
456+ my $xp = XML::Parser-> new(Style => ' Tree' , NoExpand => 1,
457+ @{$self -> {opt }-> {parseropts }});
458+ $xp -> setHandlers(ExternEnt => sub {return ' ' }, Default => sub {});
458459
459460 return $xp ;
460461}
Original file line number Diff line number Diff line change 1+ use strict;
2+ use warnings;
3+ use Test::More;
4+
5+ eval { require XML::Parser; };
6+ if ($@ ) {
7+ plan skip_all => ' no XML::Parser' ;
8+ }
9+
10+ plan tests => 2;
11+
12+ use XML::Simple;
13+
14+ $XML::Simple::PREFERRED_PARSER = ' XML::Parser' ;
15+
16+ my $xml = qq( <?xml version="1.0"?>
17+ <!DOCTYPE foo [
18+ <!ENTITY b "XML bomb" >]>
19+ <foo>&b;</foo>
20+ ) ;
21+
22+ my $opt = XMLin($xml );
23+ isnt($opt , ' XML bomb' , ' Internal subset entity not expanded' );
24+ is_deeply($opt , {}, ' Internal subset entity left as empty' );
25+
26+ exit (0);
You can’t perform that action at this time.
0 commit comments