diff options
author | Adrian M. Enache <enache@rdslink.ro> | 2003-03-29 01:53:09 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-05-05 20:07:33 +0000 |
commit | 4b3c1a47dc0fd4f1dba8913d1d8984fe79997756 (patch) | |
tree | d9997bad58e169c9c44a18aa34a1eb1bd6a214c0 | |
parent | 048912995c485d977c9d43b63b517de870c722d5 (diff) | |
download | perl-4b3c1a47dc0fd4f1dba8913d1d8984fe79997756.tar.gz |
[patch] Re: [perl #21728] regexp SEGV
Message-ID: <20030328215309.GA6413@ratsnest.hole>
(with minor tweaks)
p4raw-id: //depot/perl@19431
-rw-r--r-- | embed.fnc | 1 | ||||
-rw-r--r-- | embed.h | 2 | ||||
-rw-r--r-- | global.sym | 1 | ||||
-rw-r--r-- | proto.h | 1 | ||||
-rw-r--r-- | regexec.c | 2 | ||||
-rw-r--r-- | scope.c | 9 | ||||
-rw-r--r-- | scope.h | 3 |
7 files changed, 16 insertions, 3 deletions
@@ -630,6 +630,7 @@ Apd |char* |savepv |const char* pv Apd |char* |savesharedpv |const char* pv Apd |char* |savepvn |const char* pv|I32 len Ap |void |savestack_grow +Ap |void |savestack_grow_cnt |I32 need Ap |void |save_aelem |AV* av|I32 idx|SV **sptr Ap |I32 |save_alloc |I32 size|I32 pad Ap |void |save_aptr |AV** aptr @@ -876,6 +876,7 @@ #define savesharedpv Perl_savesharedpv #define savepvn Perl_savepvn #define savestack_grow Perl_savestack_grow +#define savestack_grow_cnt Perl_savestack_grow_cnt #define save_aelem Perl_save_aelem #define save_alloc Perl_save_alloc #define save_aptr Perl_save_aptr @@ -3356,6 +3357,7 @@ #define savesharedpv(a) Perl_savesharedpv(aTHX_ a) #define savepvn(a,b) Perl_savepvn(aTHX_ a,b) #define savestack_grow() Perl_savestack_grow(aTHX) +#define savestack_grow_cnt(a) Perl_savestack_grow_cnt(aTHX_ a) #define save_aelem(a,b,c) Perl_save_aelem(aTHX_ a,b,c) #define save_alloc(a,b) Perl_save_alloc(aTHX_ a,b) #define save_aptr(a) Perl_save_aptr(aTHX_ a) diff --git a/global.sym b/global.sym index 4f779049ab..dca38103c7 100644 --- a/global.sym +++ b/global.sym @@ -374,6 +374,7 @@ Perl_savepv Perl_savesharedpv Perl_savepvn Perl_savestack_grow +Perl_savestack_grow_cnt Perl_save_aelem Perl_save_alloc Perl_save_aptr @@ -661,6 +661,7 @@ PERL_CALLCONV char* Perl_savepv(pTHX_ const char* pv); PERL_CALLCONV char* Perl_savesharedpv(pTHX_ const char* pv); PERL_CALLCONV char* Perl_savepvn(pTHX_ const char* pv, I32 len); PERL_CALLCONV void Perl_savestack_grow(pTHX); +PERL_CALLCONV void Perl_savestack_grow_cnt(pTHX_ I32 need); PERL_CALLCONV void Perl_save_aelem(pTHX_ AV* av, I32 idx, SV **sptr); PERL_CALLCONV I32 Perl_save_alloc(pTHX_ I32 size, I32 pad); PERL_CALLCONV void Perl_save_aptr(pTHX_ AV** aptr); @@ -172,7 +172,7 @@ S_regcppush(pTHX_ I32 parenfloor) Perl_croak(aTHX_ "panic: paren_elems_to_push < 0"); #define REGCP_OTHER_ELEMS 6 - SSCHECK(paren_elems_to_push + REGCP_OTHER_ELEMS); + SSGROW(paren_elems_to_push + REGCP_OTHER_ELEMS); for (p = PL_regsize; p > parenfloor; p--) { /* REGCP_PARENS_ELEMS are pushed per pairs of parentheses. */ SSPUSHINT(PL_regendp[p]); @@ -155,6 +155,13 @@ Perl_savestack_grow(pTHX) Renew(PL_savestack, PL_savestack_max, ANY); } +void +Perl_savestack_grow_cnt(pTHX_ I32 need) +{ + PL_savestack_max = PL_savestack_ix + need; + Renew(PL_savestack, PL_savestack_max, ANY); +} + #undef GROW void @@ -277,7 +284,7 @@ Perl_save_shared_pvref(pTHX_ char **str) void Perl_save_gp(pTHX_ GV *gv, I32 empty) { - SSCHECK(6); + SSGROW(6); SSPUSHIV((IV)SvLEN(gv)); SvLEN(gv) = 0; /* forget that anything was allocated here */ SSPUSHIV((IV)SvCUR(gv)); @@ -52,7 +52,8 @@ #define SCOPE_SAVES_SIGNAL_MASK 0 #endif -#define SSCHECK(need) if (PL_savestack_ix + need > PL_savestack_max) savestack_grow() +#define SSCHECK(need) if (PL_savestack_ix + (need) > PL_savestack_max) savestack_grow() +#define SSGROW(need) if (PL_savestack_ix + (need) > PL_savestack_max) savestack_grow_cnt(need) #define SSPUSHINT(i) (PL_savestack[PL_savestack_ix++].any_i32 = (I32)(i)) #define SSPUSHLONG(i) (PL_savestack[PL_savestack_ix++].any_long = (long)(i)) #define SSPUSHBOOL(p) (PL_savestack[PL_savestack_ix++].any_bool = (p)) |