This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #91834] utf8::decode does not respect copy-on-write
[perl5.git] / universal.c
index 145d860..d012c0f 100644 (file)
@@ -695,6 +695,7 @@ XS(XS_utf8_decode)
        croak_xs_usage(cv, "sv");
     else {
        SV * const sv = ST(0);
+       if (SvIsCOW(sv)) sv_force_normal(sv);
        const bool RETVAL = sv_utf8_decode(sv);
        ST(0) = boolSV(RETVAL);
        sv_2mortal(ST(0));