THRIFT-2182 rb: segfault in regression tests (GC bug in rb_thrift_memory_buffer_write)
Patch: Paul Brannan
diff --git a/lib/rb/ext/memory_buffer.c b/lib/rb/ext/memory_buffer.c
index e7253dc..8b52c4a 100644
--- a/lib/rb/ext/memory_buffer.c
+++ b/lib/rb/ext/memory_buffer.c
@@ -39,7 +39,7 @@
VALUE rb_thrift_memory_buffer_write(VALUE self, VALUE str) {
VALUE buf = GET_BUF(self);
str = force_binary_encoding(str);
- rb_str_buf_cat(buf, RSTRING_PTR(str), RSTRING_LEN(str));
+ rb_str_buf_cat(buf, StringValuePtr(str), RSTRING_LEN(str));
return Qnil;
}