Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.9.2
-
None
-
OS X 10.10.4
Description
When attempting to serialize a malformed union, the serializer segfaults.
This simple case reproduces the issue:
test.thrift
struct Child { } union Parent { 1: optional Child child }
The code is generated with thrift --gen rb test.thrift.
Running the following script produces the segfault:
test.rb
require './gen-rb/test_types.rb' Thrift::Serializer.new.serialize(Parent.new({ foo: :bar }))
I'm using Ruby version 2.1.5p273 (2014-11-13 revision 48405), and Thrift version 0.9.2
Ruby prints the following when running the script:
/Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/serializer/serializer.rb:29: [BUG] Segmentation fault at 0x00000000000018 ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin14.0] -- Crash Report log information -------------------------------------------- See Crash Report log file under the one of following: * ~/Library/Logs/CrashReporter * /Library/Logs/CrashReporter * ~/Library/Logs/DiagnosticReports * /Library/Logs/DiagnosticReports for more details. -- Control frame information ----------------------------------------------- c:0004 p:---- s:0012 e:000011 CFUNC :write c:0003 p:0019 s:0008 e:000007 METHOD /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/serializer/serializer.rb:29 c:0002 p:0038 s:0004 E:0003f8 EVAL test.rb:3 [FINISH] c:0001 p:0000 s:0002 E:001ff8 TOP [FINISH] test.rb:3:in `<main>' /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/serializer/serializer.rb:29:in `serialize' /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/serializer/serializer.rb:29:in `write' -- C level backtrace information ------------------------------------------- 0 ruby 0x0000000109a6ce50 rb_vm_bugreport + 144 1 ruby 0x000000010991e9b1 report_bug + 305 2 ruby 0x000000010991e874 rb_bug + 180 3 ruby 0x00000001099ef1bc sigsegv + 156 4 libsystem_platform.dylib 0x00007fff98f75f1a _sigtramp + 26 5 ruby 0x0000000109947191 rb_hash_aref + 17 6 ??? 0x0000000000000008 0x0 + 8 -- Other runtime information ----------------------------------------------- * Loaded script: test.rb * Loaded features: 0 enumerator.so 1 enc/encdb.so 2 enc/trans/transdb.so 3 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/x86_64-darwin14.0/rbconfig.rb 4 thread.rb 5 thread.so 6 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/compatibility.rb 7 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/defaults.rb 8 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/deprecate.rb 9 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/errors.rb 10 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/version.rb 11 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/requirement.rb 12 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/platform.rb 13 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/basic_specification.rb 14 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/stub_specification.rb 15 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/util/stringio.rb 16 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb 17 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/exceptions.rb 18 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_gem.rb 19 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb 20 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb 21 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems.rb 22 pathname.so 23 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/pathname.rb 24 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/constants.rb 25 io/console.so 26 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/user_interaction.rb 27 etc.so 28 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/config_file.rb 29 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/rubygems_integration.rb 30 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/current_ruby.rb 31 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb 32 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/shared_helpers.rb 33 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/fileutils.rb 34 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/gem_path_manipulation.rb 35 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/gem_helpers.rb 36 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/match_platform.rb 37 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/rubygems_ext.rb 38 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/version.rb 39 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler.rb 40 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/settings.rb 41 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/path_support.rb 42 digest.so 43 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/digest.rb 44 digest/sha1.so 45 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/set.rb 46 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/definition.rb 47 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/dependency.rb 48 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/ruby_dsl.rb 49 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/dsl.rb 50 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/source_list.rb 51 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/source.rb 52 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/uri/common.rb 53 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/uri/generic.rb 54 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/uri/ftp.rb 55 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/uri/http.rb 56 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/uri/https.rb 57 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/uri/ldap.rb 58 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/uri/ldaps.rb 59 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/uri/mailto.rb 60 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/uri.rb 61 socket.so 62 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/socket.rb 63 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/timeout.rb 64 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/protocol.rb 65 zlib.so 66 stringio.so 67 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/http/exceptions.rb 68 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/http/header.rb 69 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/http/generic_request.rb 70 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/http/request.rb 71 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/http/requests.rb 72 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/http/response.rb 73 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/http/responses.rb 74 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/http/proxy_delta.rb 75 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/http/backward.rb 76 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/http.rb 77 date_core.so 78 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/date/format.rb 79 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/date.rb 80 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/time.rb 81 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/request/http_pool.rb 82 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/request/https_pool.rb 83 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/request/connection_pools.rb 84 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/request.rb 85 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/cgi/core.rb 86 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/cgi/util.rb 87 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/cgi/cookie.rb 88 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/cgi.rb 89 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/uri_formatter.rb 90 fcntl.so 91 openssl.so 92 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/openssl/bn.rb 93 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/openssl/cipher.rb 94 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/openssl/config.rb 95 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/openssl/digest.rb 96 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/openssl/x509.rb 97 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/openssl/buffering.rb 98 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/openssl/ssl.rb 99 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/openssl.rb 100 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/securerandom.rb 101 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/resolv.rb 102 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/remote_fetcher.rb 103 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/text.rb 104 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/name_tuple.rb 105 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/spec_fetcher.rb 106 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/source/rubygems.rb 107 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/ruby_version.rb 108 strscan.so 109 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/source/path.rb 110 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/source/git.rb 111 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/lockfile_parser.rb 112 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/lazy_specification.rb 113 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb 114 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/forwardable.rb 115 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/spec_set.rb 116 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/environment.rb 117 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/runtime.rb 118 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/index.rb 119 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/remote_specification.rb 120 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/endpoint_specification.rb 121 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/dep_proxy.rb 122 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/setup.rb 123 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/bytes.rb 124 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/core_ext/fixnum.rb 125 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/core_ext.rb 126 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/exceptions.rb 127 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/types.rb 128 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/processor.rb 129 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/client.rb 130 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/struct.rb 131 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/union.rb 132 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/struct_union.rb 133 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/serializer/serializer.rb 134 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/serializer/deserializer.rb 135 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/protocol/base_protocol.rb 136 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/protocol/binary_protocol.rb 137 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/protocol/binary_protocol_accelerated.rb 138 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/protocol/compact_protocol.rb 139 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/protocol/json_protocol.rb 140 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/transport/base_transport.rb 141 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/transport/base_server_transport.rb 142 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/transport/socket.rb 143 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/transport/server_socket.rb 144 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/transport/unix_socket.rb 145 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/transport/unix_server_socket.rb 146 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/transport/buffered_transport.rb 147 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/transport/framed_transport.rb 148 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/https.rb 149 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/transport/http_client_transport.rb 150 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/transport/io_stream_transport.rb 151 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/transport/memory_buffer_transport.rb 152 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/server/base_server.rb 153 /Users/joe/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/logger.rb 154 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/server/nonblocking_server.rb 155 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/server/simple_server.rb 156 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/server/threaded_server.rb 157 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/server/thread_pool_server.rb 158 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift_native.bundle 159 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift/thrift_native.rb 160 /Users/joe/.rvm/gems/ruby-2.1.5@global/gems/thrift-0.9.2.0/lib/thrift.rb 161 /private/tmp/segfault/gen-rb/test_types.rb [NOTE] You may have encountered a bug in the Ruby interpreter or extension libraries. Bug reports are welcome. Don't forget to include the above Crash Report log file. For details: http://www.ruby-lang.org/bugreport.html Abort trap: 6