From: Jarkko Hietaniemi Date: Mon, 27 Nov 2000 02:31:35 +0000 (+0000) Subject: The code in regcppop() (see #7878) contains the correct lower X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=09e8ae3b675695eeca309327a14174ff5ec475ce;p=p5sagit%2Fp5-mst-13.2.git The code in regcppop() (see #7878) contains the correct lower limit for the unused submatch 'cleanup' loop so that under "use utf8" the following code wouldn't dump core: "," =~ /([^,]*,)*/ With the the wrong lower limit (>=1) the cleanup loop in regtry() stomped beyond allocated area in the startp[] array. Therefore, copied the correct lower loop limit (*PL_reglastparen) to regtry(). Note: something may still not be quite right: why was the _higher_ loop limit (prog->nparens) different in the utf8 case? After this patch "./perl -Ilib -Mutf8 t/op/regexp.t" works without core dumps, there were about 17 of them before the patch (with us since Perl 5.7.0). Two failures, still: 496 and 505 (though these may not be severe). Patch #7881 is also needed since both the cleanup loops seem to be needed. Also, the t/op/pat#44 seems to core dump under utf8. Plus a couple of failures. UGH-8. p4raw-id: //depot/perl@7879 --- diff --git a/regexec.c b/regexec.c index 1c599de..4cb17f6 100644 --- a/regexec.c +++ b/regexec.c @@ -196,7 +196,7 @@ S_regcppop(pTHX) * a better location to since this code can #if 0-ed out * but the code in regtry() is needed or otherwise tests * requiring null fields (pat.t#187 and split.t#{13,14} - * (as of 7877) will fail. --jhi */ + * (as of patchlevel 7877) will fail. --jhi */ for (paren = *PL_reglastparen + 1; paren <= PL_regnpar; paren++) { if (paren > PL_regsize) PL_regstartp[paren] = -1; @@ -1810,7 +1810,7 @@ S_regtry(pTHX_ regexp *prog, char *startpos) sp = prog->startp; ep = prog->endp; if (prog->nparens) { - for (i = prog->nparens; i >= 1; i--) { + for (i = prog->nparens; i > *PL_reglastparen; i--) { *++sp = -1; *++ep = -1; }