This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #129267] Test for gv_fetchmethod buffer overrun
authorFather Chrysostomos <sprout@cpan.org>
Wed, 14 Sep 2016 05:38:59 +0000 (22:38 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Wed, 14 Sep 2016 05:40:58 +0000 (22:40 -0700)
ext/XS-APItest/APItest.xs
ext/XS-APItest/t/gv_fetchmethod_flags.t

index 992b6a5..4602cee 100644 (file)
@@ -2571,6 +2571,9 @@ gv_fetchmethod_flags_type(stash, methname, type, flags)
                gv = gv_fetchmethod_pvn_flags(stash, name, len, flags | SvUTF8(methname));
                break;
             }
+           case 4:
+               gv = gv_fetchmethod_pvn_flags(stash, SvPV_nolen(methname),
+                                             flags, SvUTF8(methname));
         }
        XPUSHs( gv ? (SV*)gv : &PL_sv_undef);
 
index 15d1c41..2da3b70 100644 (file)
@@ -49,3 +49,8 @@ is XS::APItest::gv_fetchmethod_flags_type(\%::, "method\0not quite!", 2, 0), "*m
         }
     }
 }
+
+# [perl #129267] Buffer overrun when argument name ends with colon and
+#                there is a colon past the end.  This used to segv.
+XS::APItest::gv_fetchmethod_flags_type(\%::, "method:::::", 4, 7);
+                                             # With type 4, 7 is the length