develooper Front page | perl.perl5.porters | Postings from May 2003

Re: [perl #21968] pattern match hangs on malformed UTF-8 input

Thread Previous
From:
Nicholas Clark
Date:
May 17, 2003 04:29
Subject:
Re: [perl #21968] pattern match hangs on malformed UTF-8 input
Message ID:
20030517112639.GA482@Bagpuss.unfortu.net
On Tue, Apr 15, 2003 at 01:44:12PM -0000, Josh Mankoff wrote:

I don't think that anyone has replied to this yet. Sorry.

> The following perl script hangs on my system. I realize that the input is
> malformed UTF-8, but I would expect to get the error message "malformed
> UTF-8 input". Note that there seems to be a small class of replacement
> patterns that cause a hang. It seems to be any character class followed by a
> single space:
> 
> printf "x\0227 " | perl -e 'use utf8; while (<STDIN>) { s/\d //; }'
> 
> Note that the perl script also hangs in Perl 5.8 without the 'use utf8', but
> with the LANG environment variable set to a locale that expects UTF-8.

I can replicate this with 5.6.1 on a Debian box, but I can't replicate
the hang on 5.8.0. I've tried 5.8.0 built with and without threads,
with and without a UTF8 locale and there is no hang. Could you send the
perl -V output for your 5.8.0 that hangs?

Thanks

Nicholas Clark

Thread Previous


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