This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
utf8_heavy: Guard against infinite recursion
authorKarl Williamson <public@khwilliamson.com>
Sun, 14 Nov 2010 19:11:12 +0000 (12:11 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 22 Nov 2010 21:32:53 +0000 (13:32 -0800)
commit3dd10fe8450c405da35678d844f7a7fbb1dafc9f
treefcbe96a23c102626dd3b8bc1810e3d8e5af6b1f6
parentef87b810d4ce2a22ca2d29a43907edb11b57b933
utf8_heavy: Guard against infinite recursion

If things aren't just so, it could be that utf8_heavy calls something
which requires a pattern, such as split or just a pattern match that
ends up calling utf8_heavy again, ad infinitum.  When this happens,
memory gets eaten up and the machine grinds to a halt, likely requiring a
manual forced reboot.

To prevent this undesirable situation, utf8_heavy now stacks all its
calls in progress, and if any is a repeat, panics.
lib/utf8_heavy.pl