diff --git a/sv.c b/sv.c index ac5337a33b9cd..25de20bbca614 100644 --- a/sv.c +++ b/sv.c @@ -4912,6 +4912,12 @@ Perl_sv_setsv_cow(pTHX_ SV **pdsv, SV *ssv) sv_dump(dsv); } #endif + if (!CHECK_COWBUF_THRESHOLD(cur, len) + || ! CHECK_COW_THRESHOLD(cur, len)) { + DEBUG_C(PerlIO_printf(Perl_debug_log, + "Fast copy on write: Sizes not appropriate to COW\n")); + return FALSE; + } if (dsv) { if (SvTHINKFIRST(dsv)) sv_force_normal_flags(dsv, SV_COW_DROP_PV);