# New Ticket Created by Father Chrysostomos
# Please include the string: [perl #41618]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=41618 >
If the following hold true--
- die is called outside an eval
- its argument is an object with overloaded stringification
- while the stringification subroutine is on the call stack a
substitution is performed
- the substitution's regexp contains [\x{d800}-\x{dbff}]
--then the substitution operator will automagically call the
stringification routine again with the same arguments, thereby
causing infinite recursion.
Here is a test script:
#!/usr/bin/perl -lw
no warnings 'once';
use Carp 'longmess';
use overload '""' => sub {
warn longmess if ++$count == 10;
my $x = 'thing'; # any string will trigger the bug
$x =~ s/([\x{d800}-\x{dbff}])([\x{dc00}-\x{dfff}])/
chr 0x10000 + (ord($1) - 0xD800) * 0x400 +
(ord($2) - 0xDC00)
/ge;
$x
};
$thing = bless [];
die $thing;
# die "$thing"; # this one works, because 'die' is not doing the
stringification
__END__
If I use s/[a-e]/b/g for the substitution, the bug is not triggered.
It's the [\x{d800}-\x{dbff}] that does it.
This bug exists in 5.9.4 as well as 5.8.8.
This is a really obscure bug--it took me a while to reproduce it. :-)
---
Flags:
category=core
severity=
---
Site configuration information for perl v5.8.8:
Configured by neo at Tue Jan 9 16:06:53 PST 2007.
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=darwin, osvers=8.8.0, archname=darwin-thread-multi-2level
uname='darwin treebeard.local 8.8.0 darwin kernel version 8.8.0:
fri sep 8 17:18:57 pdt 2006; root:xnu-792.12.6.obj~1release_ppc power
macintosh powerpc '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-g -pipe -fno-common -DPERL_DARWIN -no-cpp-
precomp -fno-strict-aliasing -I/usr/local/include',
optimize='-O3',
cppflags='-no-cpp-precomp -g -pipe -fno-common -DPERL_DARWIN -no-
cpp-precomp -fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='4.0.0 20041026 (Apple Computer, Inc.
build 4061)', gccosandvers='darwin8'
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8,
Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/
local/lib'
libpth=/usr/local/lib /usr/lib
libs=-ldbm -ldl -lm -lc
perllibs=-ldl -lm -lc
libc=, so=dylib, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/
usr/local/lib'
Locally applied patches:
---
@INC for perl v5.8.8:
/usr/local/lib/perl5/5.8.8/darwin-thread-multi-2level
/usr/local/lib/perl5/5.8.8
/usr/local/lib/perl5/site_perl/5.8.8/darwin-thread-multi-2level
/usr/local/lib/perl5/site_perl/5.8.8
/usr/local/lib/perl5/site_perl
/System/Library/Perl/5.8.6/darwin-thread-multi-2level
/System/Library/Perl/5.8.6/darwin-thread-multi-2level
/System/Library/Perl/5.8.6
/Library/Perl/5.8.6/darwin-thread-multi-2level
/Library/Perl/5.8.6/darwin-thread-multi-2level
/Library/Perl/5.8.6
/Library/Perl
/Network/Library/Perl/5.8.6/darwin-thread-multi-2level
/Network/Library/Perl/5.8.6
/Network/Library/Perl
/System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.8.6
/Library/Perl/5.8.1
.
---
Environment for perl v5.8.8:
DYLD_LIBRARY_PATH (unset)
HOME=/Users/neo
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/TeX/bin/powerpc-
darwin6.8:/usr/local/bin
PERL_BADLANG (unset)
SHELL=/bin/bash