Subject: | Wrong regexp in SVG/XML.pm |
Date: | Fri, 22 Jan 2010 13:30:48 +0100 |
To: | bug-SVG [...] rt.cpan.org |
From: | Stephan Struckmann <stephan.struckmann [...] t-online.de> |
Dear Ronan,
unfortunately I have to report a bug in your SVG perl modules. In line
59 in SVG/XML.pm chr($1) is used although ord($1) obviously was intended:
$s=~s/([\x00-\x1f])/sprintf('&#x%02X;',chr($1))/eg;
should become:
$s=~s/([\x00-\x1f])/sprintf('&#x%02X;',ord($1))/eg;
* Distribution name and version: RONAN/SVG-2.44.tar.gz, but the code
affected is unchanged in 2.49
* Perl version v5.8.8 built for i486-linux-gnu-thread-multi
* Operating System vendor and version Linux bio 2.6.18-6-686-bigmem
#1 SMP Sat Dec 27 10:38:36 UTC 2008 i686 GNU/Linux
I get the following error messages:
Argument "\x{a}" isn't numeric in chr at
/usr/local/share/perl/5.8.8/SVG/XML.pm line 59.
Argument "\0" isn't numeric in sprintf at
/usr/local/share/perl/5.8.8/SVG/XML.pm line 59.
To reproduce the bug, try to parse an SVG file containing the following
text:
<text fill="rgb(0,0,0)" font-size="8" font-weight="normal"
id="3065-799-1798" style="font-family: Helvetica" x="799" y="1804">
[@hkb:536:8bp]: hkb-536
</text>
This will lead to a call of the SVG/XML::xmlescp function with the
following parameter:
xmlescp( "\n[@hkb:536:8bp]: hkb-536" )
or as a decimal ASCII codes:
10 91 64 104 107 98 58 53 51 54 58 56 98 112 93 58 32 104 107 98 45 53 51 54
Thank you for your great module,
Stephan Struckmann