summaryrefslogtreecommitdiff
path: root/lib/rb
diff options
context:
space:
mode:
authorJames E. King III <jking@apache.org>2019-02-14 16:46:38 -0500
committerGitHub <noreply@github.com>2019-02-14 16:46:38 -0500
commitdbc1f8def5018ce5d85d38b9875c6c6b6b424478 (patch)
tree0011127f2edd9221f973eb157438bbd11c0b74d2 /lib/rb
parent3ca88065dfdb24c5bad6fbd1e3a7e01812628d3b (diff)
downloadthrift-dbc1f8def5018ce5d85d38b9875c6c6b6b424478.tar.gz
THRIFT-4024, THRIFT-4783: throw when skipping invalid type (#1742)
* THRIFT-4024: make c_glib throw on unsupported type when skipping * THRIFT-4783: throw on invalid skip (py) * THRIFT-4024: make cpp throw on unsupported type when skipping * THRIFT-4024: uniform skip behavior on unsupported type
Diffstat (limited to 'lib/rb')
-rw-r--r--lib/rb/lib/thrift/protocol/base_protocol.rb4
-rw-r--r--lib/rb/spec/base_protocol_spec.rb1
2 files changed, 2 insertions, 3 deletions
diff --git a/lib/rb/lib/thrift/protocol/base_protocol.rb b/lib/rb/lib/thrift/protocol/base_protocol.rb
index 5c693e99f..4d83a21dd 100644
--- a/lib/rb/lib/thrift/protocol/base_protocol.rb
+++ b/lib/rb/lib/thrift/protocol/base_protocol.rb
@@ -323,8 +323,6 @@ module Thrift
def skip(type)
case type
- when Types::STOP
- nil
when Types::BOOL
read_bool
when Types::BYTE
@@ -367,6 +365,8 @@ module Thrift
skip(etype)
end
read_list_end
+ else
+ raise ProtocolException.new(ProtocolException::INVALID_DATA, 'Invalid data')
end
end
diff --git a/lib/rb/spec/base_protocol_spec.rb b/lib/rb/spec/base_protocol_spec.rb
index eca936b23..cfa7573d8 100644
--- a/lib/rb/spec/base_protocol_spec.rb
+++ b/lib/rb/spec/base_protocol_spec.rb
@@ -163,7 +163,6 @@ describe 'BaseProtocol' do
@prot.skip(Thrift::Types::I64)
@prot.skip(Thrift::Types::DOUBLE)
@prot.skip(Thrift::Types::STRING)
- @prot.skip(Thrift::Types::STOP) # should do absolutely nothing
end
it "should skip structs" do