From: Rafael Garcia-Suarez <rgarciasuarez@gmail.com>
Date: Wed, 31 Oct 2007 10:15:12 +0000 (+0000)
Subject: Fix (or hide?) a case of memory corruption with \K in substitutions
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3792316810e8efe46eb83b553a1fffc0e1a35b80;p=p5sagit%2Fp5-mst-13.2.git

Fix (or hide?) a case of memory corruption with \K in substitutions

p4raw-id: //depot/perl@32206
---

diff --git a/regcomp.c b/regcomp.c
index 3ad5d8c..7c8c391 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -6898,6 +6898,11 @@ tryagain:
 	    RExC_seen_zerolen++;
 	    ret = reg_node(pRExC_state, KEEPS);
 	    *flagp |= SIMPLE;
+	    /* XXX:dmq : disabling in-place substitution seems to
+	     * be necessary here to avoid cases of memory corruption, as
+	     * with: C<$_="x" x 80; s/x\K/y/> -- rgs
+	     */
+	    RExC_seen |= REG_SEEN_LOOKBEHIND;
 	    goto finish_meta_pat;
 	case 'Z':
 	    ret = reg_node(pRExC_state, SEOL);