From: Hugo van der Sanden Date: Thu, 11 Mar 2004 16:21:50 +0000 (+0000) Subject: Fix a bug in the cloning of regexps X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e01c5899dd5c15c076ff80faae646f1bb851ca52;p=p5sagit%2Fp5-mst-13.2.git Fix a bug in the cloning of regexps Subject: Re: [perl #27530] Regex qr// interpolation fails when chr(0) is used in a thread Message-Id: <200403111621.i2BGLoi20225@zen.crypt.org> (plus another similar fix) p4raw-id: //depot/perl@22490 --- diff --git a/sv.c b/sv.c index 70e157d..2d46839 100644 --- a/sv.c +++ b/sv.c @@ -9715,7 +9715,7 @@ Perl_re_dup(pTHX_ REGEXP *r, CLONE_PARAMS *param) New(0, ret->offsets, 2*len+1, U32); Copy(r->offsets, ret->offsets, 2*len+1, U32); - ret->precomp = SAVEPV(r->precomp); + ret->precomp = SAVEPVN(r->precomp, r->prelen); ret->refcnt = r->refcnt; ret->minlen = r->minlen; ret->prelen = r->prelen; @@ -9727,7 +9727,7 @@ Perl_re_dup(pTHX_ REGEXP *r, CLONE_PARAMS *param) ret->sublen = r->sublen; if (RX_MATCH_COPIED(ret)) - ret->subbeg = SAVEPV(r->subbeg); + ret->subbeg = SAVEPVN(r->subbeg, r->sublen); else ret->subbeg = Nullch; #ifdef PERL_COPY_ON_WRITE