[perl #74022] Parser hangs on some Unicode characters
authorFather Chrysostomos <sprout@cpan.org>
Sun, 14 Nov 2010 14:46:27 +0000 (06:46 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 14 Nov 2010 14:47:29 +0000 (06:47 -0800)
commitd7425188c3bef8a77425c103db57cf8cde99f5a0
tree1a649e3245dda59642b418932fae58062cc9a02b
parentb5d9a95357621a0a9d375ff6a83672c7f150655e
[perl #74022] Parser hangs on some Unicode characters

This changes the definition of isIDFIRST_utf8 to avoid any characters
that would put the parser in a loop.

isIDFIRST_utf8 is used all over the place in toke.c. Almost every
instance is followed by a call to S_scan_word. S_scan_word is only
called when it is known that there is a word to scan.

What was happening was that isIDFIRST_utf8 would accept a character,
but S_scan_word in toke.t would then reject it, as it was using
is_utf8_alnum, resulting in an infinite number of zero-length
identifiers.

Another possible solution was to change S_scan_word to use
isIDFIRST_utf8 or similar, but that has back-compatibility problems,
as it stops q·foo· from being a strings and makes it an identi-
fier instead.
handy.h
t/comp/parser.t