This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Change 33807 to fix bug #52740 wasn't quite right, as it ended up with
authorNicholas Clark <nick@ccl4.org>
Thu, 21 Aug 2008 21:47:14 +0000 (21:47 +0000)
committerNicholas Clark <nick@ccl4.org>
Thu, 21 Aug 2008 21:47:14 +0000 (21:47 +0000)
unitialised reads (and sometimes even SEGVs).

p4raw-id: //depot/perl@34213

sv.c

diff --git a/sv.c b/sv.c
index f721e6f..5fcf018 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -3717,7 +3717,7 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV* sstr, const I32 flags)
            Perl_croak(aTHX_ "Cannot copy to %s", type);
     } else if (sflags & SVf_ROK) {
        if (isGV_with_GP(dstr) && dtype == SVt_PVGV
-           && SvTYPE(SvRV(sstr)) == SVt_PVGV) {
+           && SvTYPE(SvRV(sstr)) == SVt_PVGV && isGV_with_GP(SvRV(sstr))) {
            sstr = SvRV(sstr);
            if (sstr == dstr) {
                if (GvIMPORTED(dstr) != GVf_IMPORTED
@@ -3728,10 +3728,8 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV* sstr, const I32 flags)
                GvMULTI_on(dstr);
                return;
            }
-           if (isGV_with_GP(sstr)) {
-               glob_assign_glob(dstr, sstr, dtype);
-               return;
-           }
+           glob_assign_glob(dstr, sstr, dtype);
+           return;
        }
 
        if (dtype >= SVt_PV) {