Fix (or hide?) a case of memory corruption with \K in substitutions
Rafael Garcia-Suarez [Wed, 31 Oct 2007 10:15:12 +0000 (10:15 +0000)]
p4raw-id: //depot/perl@32206

regcomp.c

index 3ad5d8c..7c8c391 100644 (file)
--- 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);