THRIFT-2182 rb: segfault in regression tests (GC bug in rb_thrift_memory_buffer_write)
Patch: Paul Brannan
diff --git a/lib/rb/ext/compact_protocol.c b/lib/rb/ext/compact_protocol.c
index 1637e99..725d338 100644
--- a/lib/rb/ext/compact_protocol.c
+++ b/lib/rb/ext/compact_protocol.c
@@ -315,7 +315,7 @@
buf = force_binary_encoding(buf);
VALUE transport = GET_TRANSPORT(self);
write_varint32(transport, RSTRING_LEN(buf));
- WRITE(transport, RSTRING_PTR(buf), RSTRING_LEN(buf));
+ WRITE(transport, StringValuePtr(buf), RSTRING_LEN(buf));
return Qnil;
}