This queue is for tickets about the HTML-Parser CPAN distribution.

Report information
The Basics
Id:
84144
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
demerphq [...] gmail.com
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: HTML::Entities does not handle shared keys properly
Later perl's do tricks to share keys, and HTML::Entities trips up on them. The following code is generating an incorrect error message, the key is actually modifyable. $ perl5.14.2 -MDevel::Peek -MHTML::Entities -le'print $]; my %hash=("A".."D"); @x= sort keys %hash; decode_entities($x[0]);' 5.014002 Can't inline decode readonly string at -e line 1. Devel::Peek output looks like this: $ perl5.14.2 -MDevel::Peek -le'print $]; my %hash=("A".."D"); @x= keys %hash; Dump($x[0]);' 5.014002 SV = PV(0xbd91e0) at 0xbed7f0 REFCNT = 1 FLAGS = (POK,FAKE,READONLY,pPOK) PV = 0xbfe290 "A" CUR = 1 LEN = 0 THE combo of FAKE and READONLY means the string is shared, but can be modified. Yves
From: demerphq@gmail.com
On Fri Mar 22 13:16:42 2013, demerphq@gmail.com wrote:
Show quoted text
> Later perl's do tricks to share keys, and HTML::Entities trips up on > them. > > The following code is generating an incorrect error message, the key > is actually modifyable. > > $ perl5.14.2 -MDevel::Peek -MHTML::Entities -le'print $]; my > %hash=("A".."D"); @x= sort keys %hash; decode_entities($x[0]);' > 5.014002 > Can't inline decode readonly string at -e line 1. > > Devel::Peek output looks like this: > > $ perl5.14.2 -MDevel::Peek -le'print $]; my %hash=("A".."D"); @x= keys > %hash; Dump($x[0]);' > 5.014002 > SV = PV(0xbd91e0) at 0xbed7f0 > REFCNT = 1 > FLAGS = (POK,FAKE,READONLY,pPOK) > PV = 0xbfe290 "A" > CUR = 1 > LEN = 0 > > THE combo of FAKE and READONLY means the string is shared, but can be > modified.
Commentary on p5p where I raised this originally suggests that using SV_CHECK_THINKFIRST is part of the solution. Yves
From: demerphq@gmail.com
On Fri Mar 22 13:18:33 2013, demerphq@gmail.com wrote:
Show quoted text
> Commentary on p5p where I raised this originally
See: http://www.nntp.perl.org/group/perl.perl5.porters/2013/03/msg200455.html
On Fri Mar 22 13:18:33 2013, demerphq@gmail.com wrote:
Show quoted text
> Commentary on p5p where I raised this originally suggests that using > > SV_CHECK_THINKFIRST > > is part of the solution.
Correct. SV_CHECK_THINKFIRST must be called on the sv before writing to the PV of an sv, as well as before checking SvREADONLY (as for example in this case it would change the readonly shared sv into a normal writable one). This has been the case for a fairly long time, but is only now being documented. Leon
 HTML-Parser-3.70 with the fix (https://github.com/gisle/html-parser/pull/4) has been released.


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.