aboutsummaryrefslogtreecommitdiff
path: root/ruby/tests/basic.rb
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2017-01-23 11:43:57 -0800
committerPaul Yang <TeBoring@users.noreply.github.com>2017-01-23 11:43:57 -0800
commitd9668797a2e6bb41f20bad47cd2494e5aa1a156b (patch)
tree169658de8b253c23262d7bbc1f347d2d237ca449 /ruby/tests/basic.rb
parentbe83f46b67f1392a99511a36b687ce7db06efed8 (diff)
downloadprotobuf-d9668797a2e6bb41f20bad47cd2494e5aa1a156b.tar.gz
protobuf-d9668797a2e6bb41f20bad47cd2494e5aa1a156b.tar.bz2
protobuf-d9668797a2e6bb41f20bad47cd2494e5aa1a156b.zip
Update upb, fixes some bugs (including a hash table problem). (#2611)
* Update upb, fixes some bugs (including a hash table problem). * Ruby: added a test for the previous hash table corruption. Verified that this triggers the bug in the currently released version. * Ruby: bugfix for SEGV. * Ruby: removed old code for dup'ing defs.
Diffstat (limited to 'ruby/tests/basic.rb')
-rw-r--r--ruby/tests/basic.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/ruby/tests/basic.rb b/ruby/tests/basic.rb
index e0dba8bd..ca81e3a5 100644
--- a/ruby/tests/basic.rb
+++ b/ruby/tests/basic.rb
@@ -667,6 +667,13 @@ module BasicTest
end
end
+ def test_map_corruption
+ # This pattern led to a crash in a previous version of upb/protobuf.
+ m = MapMessage.new(map_string_int32: { "aaa" => 1 })
+ m.map_string_int32['podid'] = 2
+ m.map_string_int32['aaa'] = 3
+ end
+
def test_map_encode_decode
m = MapMessage.new(
:map_string_int32 => {"a" => 1, "b" => 2},