diff options
author | Perl 5 Porters <perl5-porters@africa.nicoh.com> | 1997-04-25 00:00:00 +1200 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1997-04-25 00:00:00 +1200 |
commit | fc36a67e8855d031b2a6921819d899eb149eee2d (patch) | |
tree | 7e927725470a83d271eae7d78123f60cb86e60df /pp_ctl.c | |
parent | 74a7701791a30556a92328b89e5a00414a4ce4a3 (diff) | |
download | perl-fc36a67e8855d031b2a6921819d899eb149eee2d.tar.gz |
[inseparable changes from match from perl-5.003_97h to perl-5.003_97i]
CORE PORTABILITY
Subject: Provide memset() if it's missing
From: Chip Salzenberg <chip@perl.com>
Files: global.sym perl.h proto.h util.c
Subject: Don't tell GCC that warn(), croak(), and die() are printf-lik
From: Chip Salzenberg <chip@perl.com>
Files: proto.h
DOCUMENTATION
Subject: FAQ udpate (24-apr-97)
Date: Thu, 24 Apr 1997 16:47:23 -0600 (MDT)
From: Nathan Torkington <gnat@prometheus.frii.com>
Files: pod/perlfaq*.pod
private-msgid: 199704242247.QAA07010@prometheus.frii.com
OTHER CORE CHANGES
Subject: Misc. sv_vcatpvfn() fixes
From: Hugo van der Sanden <hv@crypt.compulink.co.uk>
Files: gv.c mg.c op.c perl.c pp.c pp_ctl.c sv.c toke.c util.c
Subject: Enforce order of sprintf() elements
From: Chip Salzenberg <chip@perl.com>
Files: sv.c
Subject: Guard against long numbers, <<LONG_DELIM, and <long glob>
From: Chip Salzenberg <chip@perl.com>
Files: global.sym mg.c perl.c pod/perldiag.pod proto.h toke.c util.c
Subject: Guard against C<goto> to deeply nested label
From: Chip Salzenberg <chip@perl.com>
Files: pod/perldiag.pod pp_ctl.c
Subject: Guard against overflow in dup2() emulation
From: Chip Salzenberg <chip@perl.com>
Files: util.c
Subject: Win32: Guard against long function names
From: Chip Salzenberg <chip@perl.com>
Files: win32/win32sck.c
Subject: Make mess() always work, by using a non-arena SV
From: Chip Salzenberg <chip@perl.com>
Files: perl.c util.c
Subject: When copying a format line, take only its string value
From: Chip Salzenberg <chip@perl.com>
Files: sv.c
Subject: Fix LEAKTEST numbers
From: Chip Salzenberg <chip@perl.com>
Files: ext/DynaLoader/dl_vms.xs handy.h os2/os2.c util.c vms/vms.c win32/win32.c win32/win32sck.c
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 40 |
1 files changed, 24 insertions, 16 deletions
@@ -27,7 +27,7 @@ static OP *docatch _((OP *o)); static OP *doeval _((int gimme)); -static OP *dofindlabel _((OP *op, char *label, OP **opstack)); +static OP *dofindlabel _((OP *op, char *label, OP **opstack, OP **oplimit)); static void doparseform _((SV *sv)); static I32 dopoptoeval _((I32 startingblock)); static I32 dopoptolabel _((char *label)); @@ -1545,19 +1545,27 @@ PP(pp_redo) static OP* lastgotoprobe; static OP * -dofindlabel(op,label,opstack) +dofindlabel(op,label,opstack,oplimit) OP *op; char *label; OP **opstack; +OP **oplimit; { OP *kid; OP **ops = opstack; + static char too_deep[] = "Target of goto is too deeply nested"; + if (ops >= oplimit) + croak(too_deep); if (op->op_type == OP_LEAVE || op->op_type == OP_SCOPE || op->op_type == OP_LEAVELOOP || op->op_type == OP_LEAVETRY) - *ops++ = cUNOP->op_first; + { + *ops++ = cUNOP->op_first; + if (ops >= oplimit) + croak(too_deep); + } *ops = 0; if (op->op_flags & OPf_KIDS) { /* First try all the kids at this level, since that's likeliest. */ @@ -1569,15 +1577,12 @@ OP **opstack; for (kid = cUNOP->op_first; kid; kid = kid->op_sibling) { if (kid == lastgotoprobe) continue; - if (kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE) { - if (ops > opstack && - (ops[-1]->op_type == OP_NEXTSTATE || - ops[-1]->op_type == OP_DBSTATE)) - *ops = kid; - else - *ops++ = kid; - } - if (op = dofindlabel(kid,label,ops)) + if ((kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE) && + (ops == opstack || + (ops[-1]->op_type != OP_NEXTSTATE && + ops[-1]->op_type != OP_DBSTATE))) + *ops++ = kid; + if (op = dofindlabel(kid, label, ops, oplimit)) return op; } } @@ -1597,7 +1602,8 @@ PP(pp_goto) OP *retop = 0; I32 ix; register CONTEXT *cx; - OP *enterops[64]; +#define GOTO_DEPTH 64 + OP *enterops[GOTO_DEPTH]; char *label; int do_dump = (op->op_type == OP_DUMP); @@ -1813,7 +1819,8 @@ PP(pp_goto) gotoprobe = main_root; break; } - retop = dofindlabel(gotoprobe, label, enterops); + retop = dofindlabel(gotoprobe, label, + enterops, enterops + GOTO_DEPTH); if (retop) break; lastgotoprobe = gotoprobe; @@ -2211,7 +2218,7 @@ PP(pp_require) sv_catpv(msg, " (change .h to .ph maybe?)"); if (instr(SvPVX(msg), ".ph ")) sv_catpv(msg, " (did you run h2ph?)"); - DIE("%S", msg); + DIE("%_", msg); } RETPUSHUNDEF; @@ -2258,7 +2265,8 @@ PP(pp_entereval) register CONTEXT *cx; dPOPss; I32 gimme = GIMME_V, was = sub_generation; - char tmpbuf[sizeof(unsigned long) * 3 + 12], *safestr; + char tmpbuf[TYPE_DIGITS(long) + 12]; + char *safestr; STRLEN len; OP *ret; |