You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2009/09/02 22:05:07 UTC

svn commit: r810689 - /incubator/thrift/trunk/lib/rb/ext/binary_protocol_accelerated.c

Author: bryanduxbury
Date: Wed Sep  2 20:05:07 2009
New Revision: 810689

URL: http://svn.apache.org/viewvc?rev=810689&view=rev
Log:
THRIFT-569. rb: Segmentation Fault when using BinaryProtocolAccelerated in Ruby

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


Modified:
    incubator/thrift/trunk/lib/rb/ext/binary_protocol_accelerated.c

Modified: incubator/thrift/trunk/lib/rb/ext/binary_protocol_accelerated.c
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/ext/binary_protocol_accelerated.c?rev=810689&r1=810688&r2=810689&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/ext/binary_protocol_accelerated.c (original)
+++ incubator/thrift/trunk/lib/rb/ext/binary_protocol_accelerated.c Wed Sep  2 20:05:07 2009
@@ -76,6 +76,9 @@
 }
 
 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);
 }