Updated Branches: refs/heads/master a510d6b48 -> 0240572c4
THRIFT-2182 rb: segfault in regression tests (GC bug in rb_thrift_memory_buffer_write) Patch: Paul Brannan Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/0240572c Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/0240572c Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/0240572c Branch: refs/heads/master Commit: 0240572c44c64c3ab1d498d32a9a1530ab91b0da Parents: a510d6b Author: Roger Meier <[email protected]> Authored: Sun Jan 12 23:29:11 2014 +0100 Committer: Roger Meier <[email protected]> Committed: Sun Jan 12 23:29:11 2014 +0100 ---------------------------------------------------------------------- lib/rb/ext/compact_protocol.c | 2 +- lib/rb/ext/memory_buffer.c | 2 +- lib/rb/ext/struct.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/0240572c/lib/rb/ext/compact_protocol.c ---------------------------------------------------------------------- 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 @@ VALUE rb_thrift_compact_proto_write_binary(VALUE self, VALUE buf) { 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; } http://git-wip-us.apache.org/repos/asf/thrift/blob/0240572c/lib/rb/ext/memory_buffer.c ---------------------------------------------------------------------- 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_read_into_buffer(VALUE self, VALUE buffer_value, V 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; } http://git-wip-us.apache.org/repos/asf/thrift/blob/0240572c/lib/rb/ext/struct.c ---------------------------------------------------------------------- diff --git a/lib/rb/ext/struct.c b/lib/rb/ext/struct.c index 8fbadbe..313da4c 100644 --- a/lib/rb/ext/struct.c +++ b/lib/rb/ext/struct.c @@ -607,7 +607,7 @@ static VALUE rb_thrift_union_read(VALUE self, VALUE protocol) { if (field_type == specified_type) { // read the value VALUE name = rb_hash_aref(field_info, name_sym); - rb_iv_set(self, "@setfield", ID2SYM(rb_intern(RSTRING_PTR(name)))); + rb_iv_set(self, "@setfield", rb_str_intern(name)); rb_iv_set(self, "@value", read_anything(protocol, field_type, field_info)); } else { rb_funcall(protocol, skip_method_id, 1, field_type_value);
