From: Inaba Hiroto Date: Fri, 25 May 2001 10:25:36 +0000 (+0900) Subject: Re: [ID 20010506.041] segfault when matching utf8 string X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e49a9654d37283a906bdcb779ea9c6e236835955;p=p5sagit%2Fp5-mst-13.2.git Re: [ID 20010506.041] segfault when matching utf8 string Message-Id: <200105250124.KAA19571@toshiba.co.jp> p4raw-id: //depot/perl@10206 --- diff --git a/regcomp.c b/regcomp.c index fbda209..e264715 100644 --- a/regcomp.c +++ b/regcomp.c @@ -4657,6 +4657,7 @@ Perl_save_re_context(pTHX) SAVEVPTR(PL_reg_oldcurpm); /* from regexec.c */ SAVEVPTR(PL_reg_curpm); /* from regexec.c */ SAVEI32(PL_regnpar); /* () count. */ + SAVEI32(PL_regsize); /* from regexec.c */ #ifdef DEBUGGING SAVEPPTR(PL_reg_starttry); /* from regexec.c */ #endif diff --git a/regexec.c b/regexec.c index 9ba61d7..7c168cf 100644 --- a/regexec.c +++ b/regexec.c @@ -144,6 +144,9 @@ S_regcppush(pTHX_ I32 parenfloor) int paren_elems_to_push = (PL_regsize - parenfloor) * REGCP_PAREN_ELEMS; int p; + if (paren_elems_to_push < 0) + Perl_croak(aTHX_ "panic: paren_elems_to_push < 0"); + #define REGCP_OTHER_ELEMS 5 SSCHECK(paren_elems_to_push + REGCP_OTHER_ELEMS); for (p = PL_regsize; p > parenfloor; p--) {