summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorMarcus Holland-Moritz <mhx-perl@gmx.net>2004-06-24 16:22:05 +0000
committerMarcus Holland-Moritz <mhx-perl@gmx.net>2004-06-24 16:22:05 +0000
commit8e742a20f09cb882e499103f4c5f4964764f2a86 (patch)
tree2650c18707759bbd336e8c775c8918276c4980a2 /op.c
parent09122b95120d497042cb9df9ebb06ebcfca423aa (diff)
downloadperl-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.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/op.c b/op.c
index cdc074903e..0fd55475fa 100644
--- a/op.c
+++ b/op.c
@@ -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"]",