Skip to content

Commit 5aa746f

Browse files
eregonflavorjones
authored andcommitted
Fix utf16_string_value_ptr() for TruffleRuby
* TruffleRuby uses TruffleString which requires all UTF-16 strings to always have an even bytesize. * The code here ensures the UTF-16 string always ends up with 2 \x00 bytes, so append them explicitly to have an even bytesize instead of relying on RSTRING_PTR() adding the second \x00 byte. * Fixes truffleruby/truffleruby#2704
1 parent 28832a1 commit 5aa746f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ext/sqlite3/database.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static char *
3131
utf16_string_value_ptr(VALUE str)
3232
{
3333
StringValue(str);
34-
rb_str_buf_cat(str, "\x00", 1L);
34+
rb_str_buf_cat(str, "\x00\x00", 2L);
3535
return RSTRING_PTR(str);
3636
}
3737

0 commit comments

Comments
 (0)