summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-03-24 13:58:44 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-03-24 13:58:44 +0000
commitf54fca96add61189e2fde1d41312bc8885ac2d97 (patch)
treee8b7ae3d38ff573f69a99c5bce48c01ecab9d889
parent1f483ca187f535de63d6e6c29dc950a0b0026c4d (diff)
downloadperl-f54fca96add61189e2fde1d41312bc8885ac2d97.tar.gz
Integrate perlio:
[ 15462] Avoid core-dump in Encode with PERLIO=mmap p4raw-link: @15462 on //depot/perlio: b4d9096427023cc00e82f9ecbc4205dfe7395a78 p4raw-id: //depot/perl@15466 p4raw-integrated: from //depot/perlio@15465 'copy in' ext/Encode/Encode.xs (@15462..)
-rw-r--r--ext/Encode/Encode.xs8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/Encode/Encode.xs b/ext/Encode/Encode.xs
index 8fb41063aa..e4f7b10cbd 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);
}