From a4d7a71bfbcf858b69074d4736f0d350903d6779 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Thu, 12 Dec 2013 15:26:01 -0800 Subject: [PATCH] XS::APItest: Flatten src for utf16_to_utf8_reversed utf16_to_utf8_reversed (the C function) modifies its input, so the XS function of the same name should flatten the input to avoid modifying shared buffers. Brought to you by PERL_DEBUG_READONLY_COW. --- ext/XS-APItest/APItest.xs | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs index 1b8ec3f..f8fc1bf 100644 --- a/ext/XS-APItest/APItest.xs +++ b/ext/XS-APItest/APItest.xs @@ -2480,6 +2480,7 @@ utf16_to_utf8 (sv, ...) SV *dest; I32 got; /* Gah, badly thought out APIs */ CODE: + if (ix) (void)SvPV_force_nolen(sv); source = (U8 *)SvPVbyte(sv, len); /* Optionally only convert part of the buffer. */ if (items > 1) { -- 2.7.4