develooper Front page | perl.perl5.porters | Postings from August 2012

[perl #114558] endless loop in perl unicode converter

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
August 24, 2012 16:23
Subject:
[perl #114558] endless loop in perl unicode converter
Message ID:
rt-3.6.HEAD-11172-1345850581-1464.114558-15-0@perl.org
On Thu Aug 23 14:55:28 2012, wosch@FreeBSD.org wrote:
> Hi,
> 
> I run a script which fetch data from a web site. The site changed the
> character from utf8 to latin1. I didn't notice this until I saw some
> perl scripts running in an endless loop.
> 
> how to repeat:
> 
> perl utf8.pl < utf8.html
> utf8 "\xFF" does not map to Unicode at utf8.pl line 11, <> line 1.
> Cro
> 
> [ endless loop ]
> 
> I guess this is an off-by-one error, or a buffer overflow for a buffer
> of the size 1024 bytes. The input file utf8.html is 1028 bytes long, 3
> bytes "Cro" followed by \377, and 1023 times "x", followed by "X". If
> you remove "X", the script will not hang.
> 
> Affected OS: linux, MacOS, FreeBSD
> Affected perl version: 5.8.9 - 5.14.2
> 
> perl 5.16.1 and later seems to work fine.
> 
> see the attachments for the test case.
> 
> -Wolfram
> 

I reproduced this problem with 5.12.0 and 5.14.2; 5.16.0 ran fine.  So
there is a bug in pre-5.16 versions of perl.

However, to reproduce this I had to save your sample data as 'utf8.txt'
-- not 'utf8.html'.  The latter included all the Javascript found on the
rt.perl.org web page and so was much larger than 1028 bytes.

Thank you very much.
Jim Keenan




---
via perlbug:  queue: perl5 status: new
https://rt.perl.org:443/rt3/Ticket/Display.html?id=114558

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About