Skip to content

Commit

Permalink
keep end of string bytes \x0000
Browse files Browse the repository at this point in the history
Fixes #1017
This is also related to https://stackoverflow.com/questions/53691576/perl6-nativecall-with-str-is-encodedutf16-got-randomly-corrupted-result

This fix add the missing space for the end of string char which is 2 bytes for utf16.
  • Loading branch information
xlat authored and jnthn committed Dec 18, 2018
1 parent e5cddf3 commit 4a7da32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/strings/utf16.c
Expand Up @@ -400,7 +400,7 @@ char * MVM_string_utf16_encode_substr_main(MVMThreadContext *tc, MVMString *str,
if (!output_size)
output_size = &scratch_space;
*output_size = (char *)result_pos - (char *)result;
result = MVM_realloc(result, *output_size);
result = MVM_realloc(result, *output_size + 2);
MVM_free(repl_bytes);
return (char *)result;
}
Expand Down

0 comments on commit 4a7da32

Please sign in to comment.