This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [perl #27803] perl crashes when utf8::upgrade($offsetOK_scalar)
[perl5.git] / sv.c
diff --git a/sv.c b/sv.c
index f4b3696..02e2b55 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -3494,7 +3494,8 @@ Perl_sv_utf8_upgrade_flags(pTHX_ register SV *sv, I32 flags)
         }
         if (hibit) {
              STRLEN len;
-       
+             SvOOK_off(sv);
+             s = (U8*)SvPVX(sv);
              len = SvCUR(sv) + 1; /* Plus the \0 */
              SvPVX(sv) = (char*)bytes_to_utf8((U8*)s, &len);
              SvCUR(sv) = len - 1;