diff options
author | Marcus Holland-Moritz <mhx-perl@gmx.net> | 2004-06-24 16:22:05 +0000 |
---|---|---|
committer | Marcus Holland-Moritz <mhx-perl@gmx.net> | 2004-06-24 16:22:05 +0000 |
commit | 8e742a20f09cb882e499103f4c5f4964764f2a86 (patch) | |
tree | 2650c18707759bbd336e8c775c8918276c4980a2 /op.c | |
parent | 09122b95120d497042cb9df9ebb06ebcfca423aa (diff) | |
download | perl-8e742a20f09cb882e499103f4c5f4964764f2a86.tar.gz |
Fix for: [perl #2738] perl segfautls on input
The parser was incorrectly accepting <> as a subroutine prototype and
newATTRSUB didn't validate the proto argument before accessing op_sv.
p4raw-id: //depot/perl@22990
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -4069,11 +4069,19 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) char *name; char *aname; GV *gv; - char *ps = proto ? SvPVx(((SVOP*)proto)->op_sv, n_a) : Nullch; + char *ps; register CV *cv=0; SV *const_sv; name = o ? SvPVx(cSVOPo->op_sv, n_a) : Nullch; + + if (proto) { + assert(proto->op_type == OP_CONST); + ps = SvPVx(((SVOP*)proto)->op_sv, n_a); + } + else + ps = Nullch; + if (!name && PERLDB_NAMEANON && CopLINE(PL_curcop)) { SV *sv = sv_newmortal(); Perl_sv_setpvf(aTHX_ sv, "%s[%s:%"IVdf"]", |