From: Nick Ing-Simmons Date: Sun, 24 Mar 2002 08:59:35 +0000 (+0000) Subject: Avoid core-dump in Encode with PERLIO=mmap X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b4d9096427023cc00e82f9ecbc4205dfe7395a78;p=p5sagit%2Fp5-mst-13.2.git Avoid core-dump in Encode with PERLIO=mmap p4raw-id: //depot/perlio@15462 --- diff --git a/ext/Encode/Encode.xs b/ext/Encode/Encode.xs index 9bd8a4c..68474b6 100644 --- a/ext/Encode/Encode.xs +++ b/ext/Encode/Encode.xs @@ -576,7 +576,15 @@ encode_method(pTHX_ encode_t * enc, encpage_t * dir, SV * src, if (check) { sdone = SvCUR(src) - (slen+sdone); if (sdone) { +#if 1 + /* FIXME: A Move() is dangerous - PV could be mmap'ed readonly + SvOOK would be ideal - but sv_backoff does not understand SvLEN == 0 + type SVs and sv_clear() calls it ... + */ + sv_setpvn(src,s+slen,sdone); +#else Move(s + slen, SvPVX(src), sdone , U8); +#endif } SvCUR_set(src, sdone); }