From: Rafael Garcia-Suarez Date: Thu, 10 Oct 2002 20:19:27 +0000 (+0000) Subject: Fix bug #17776 : memory corruption in qr/##/x X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ab01544ff4579f0986e6be613b46a4801bc31f58;p=p5sagit%2Fp5-mst-13.2.git Fix bug #17776 : memory corruption in qr/##/x p4raw-id: //depot/perl@17994 --- diff --git a/sv.c b/sv.c index 2017045..f5b9849 100644 --- a/sv.c +++ b/sv.c @@ -3006,6 +3006,7 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags) need a newline */ mg->mg_len++; /* save space for it */ need_newline = 1; /* note to add it */ + break; } } } diff --git a/t/op/pat.t b/t/op/pat.t index 4ef860c..6a1d602 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -6,7 +6,7 @@ $| = 1; -print "1..940\n"; +print "1..941\n"; BEGIN { chdir 't' if -d 't'; @@ -2931,6 +2931,10 @@ print(("a$x" =~ /^a(??{$a})\z/ ? '' : 'not '), "ok $test - postponed interpolation of qr// preserves utf8\n"); ++$test; +print((length(qr/##/x) == 12 ? '' : 'not '), + "ok $test - ## in qr// doesn't corrupt memory [perl #17776]\n"); +++$test; + { use re 'eval'; print(("$x$x" =~ /^$x(??{$x})\z/ ? '' : 'not '),