diff --git a/lib/rb/lib/thrift/transport/header_transport.rb b/lib/rb/lib/thrift/transport/header_transport.rb index 8b09951c14c..1f0cd3432b8 100644 --- a/lib/rb/lib/thrift/transport/header_transport.rb +++ b/lib/rb/lib/thrift/transport/header_transport.rb @@ -498,7 +498,7 @@ def bounded_inflate(compressed) inflater.inflate(compressed, &append_chunk) inflater.finish(&append_chunk) buffer - rescue Zlib::DataError, Zlib::BufError + rescue Zlib::DataError, Zlib::BufError, Zlib::NeedDict raise TransportException.new(TransportException::UNKNOWN, "Invalid ZLIB payload") ensure inflater.close rescue nil diff --git a/lib/rb/spec/header_transport_spec.rb b/lib/rb/spec/header_transport_spec.rb index 1900014f79c..f8d90473279 100644 --- a/lib/rb/spec/header_transport_spec.rb +++ b/lib/rb/spec/header_transport_spec.rb @@ -458,6 +458,7 @@ def read(size) { "invalid" => "not-zlib", "truncated" => Zlib::Deflate.deflate("valid payload")[0...-1], + "preset dictionary" => Zlib::Deflate.new.tap { |d| d.set_dictionary("dictionary") }.deflate("valid payload", Zlib::FINISH), }.each do |failure_type, payload| it "adapts #{failure_type} ZLIB payloads to the transport exception boundary" do header_data = [