summaryrefslogtreecommitdiff
path: root/lib/rb/lib
diff options
context:
space:
mode:
authorBryan Duxbury <bryanduxbury@apache.org>2009-07-31 18:53:14 +0000
committerBryan Duxbury <bryanduxbury@apache.org>2009-07-31 18:53:14 +0000
commit293086cacc60f24d45359ed93c5ec224562b4ddd (patch)
tree6e7769ceab3cc1d8a16e7dd3cc4143c23adcb7ac /lib/rb/lib
parentccae88473962261d28d1ef56dd05637ca1445df6 (diff)
downloadthrift-293086cacc60f24d45359ed93c5ec224562b4ddd.tar.gz
THRIFT-547. rb: Thrift deserializer hangs when deserializing empty string
Thrift::MemoryBuffer will now throw an EOFError when it cannot fulfill a request for data. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@799696 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'lib/rb/lib')
-rw-r--r--lib/rb/lib/thrift/transport/memory_buffer_transport.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/rb/lib/thrift/transport/memory_buffer_transport.rb b/lib/rb/lib/thrift/transport/memory_buffer_transport.rb
index 33d732d13..b4a80f882 100644
--- a/lib/rb/lib/thrift/transport/memory_buffer_transport.rb
+++ b/lib/rb/lib/thrift/transport/memory_buffer_transport.rb
@@ -64,6 +64,9 @@ module Thrift
@buf = @buf.slice(@index..-1)
@index = 0
end
+ if data.size < len
+ raise EOFError, "Not enough bytes remain in buffer"
+ end
data
end