Permalink
Browse files

THRIFT-569. rb: Segmentation Fault when using BinaryProtocolAccelerat…

…ed in Ruby

This patch checks to make sure that a value is a string before treating it as one. 



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@810689 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 51a2dca commit 0d67a12a0a75c047e07aa5fc8fe242201c6e8154 bryanduxbury committed Sep 2, 2009
Showing with 3 additions and 0 deletions.
  1. +3 −0 lib/rb/ext/binary_protocol_accelerated.c
@@ -76,6 +76,9 @@ static void write_i64_direct(VALUE trans, int64_t value) {
}
static void write_string_direct(VALUE trans, VALUE str) {
+ if (TYPE(str) != T_STRING) {
+ rb_raise(rb_eStandardError, "Value should be a string");
+ }
write_i32_direct(trans, RSTRING_LEN(str));
rb_funcall(trans, write_method_id, 1, str);
}

0 comments on commit 0d67a12

Please sign in to comment.