This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
zero length $1 took too long to detect utf8-ness
authorDave Mitchell <davem@fdisolutions.com>
Fri, 20 Oct 2006 10:06:57 +0000 (10:06 +0000)
committerDave Mitchell <davem@fdisolutions.com>
Fri, 20 Oct 2006 10:06:57 +0000 (10:06 +0000)
p4raw-id: //depot/perl@29059

mg.c

diff --git a/mg.c b/mg.c
index b477386..3ab49c0 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -861,7 +861,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
                    TAINT_NOT;
                    sv_setpvn(sv, s, i);
                    PL_tainted = oldtainted;
-                   if (RX_MATCH_UTF8(rx) && is_utf8_string((U8*)s, i))
+                   if (RX_MATCH_UTF8(rx) && (!i || is_utf8_string((U8*)s, i)))
                        SvUTF8_on(sv);
                    else
                        SvUTF8_off(sv);