ruby-changes:58193
From: Nobuyoshi <ko1@a...>
Date: Thu, 10 Oct 2019 16:25:50 +0900 (JST)
Subject: [ruby-changes:58193] 203b7fa1ae (master): Guard static variable first
https://git.ruby-lang.org/ruby.git/commit/?id=203b7fa1ae From 203b7fa1ae8cc40d41c38d684f70b3fea7fae813 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 10 Oct 2019 16:08:39 +0900 Subject: Guard static variable first * ext/openssl/ossl_asn1.c (Init_ossl_asn1): register the static variable to grab an internal object, before creating the object. otherwise the just-created object could get collected during the global variable list allocation. [Bug #16196] diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c index ab45bd8..e00c664 100644 --- a/ext/openssl/ossl_asn1.c +++ b/ext/openssl/ossl_asn1.c @@ -1823,8 +1823,8 @@ do{\ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_asn1.c#L1823 rb_define_method(cASN1EndOfContent, "initialize", ossl_asn1eoc_initialize, 0); rb_define_method(cASN1EndOfContent, "to_der", ossl_asn1eoc_to_der, 0); - class_tag_map = rb_hash_new(); rb_global_variable(&class_tag_map); + class_tag_map = rb_hash_new(); rb_hash_aset(class_tag_map, cASN1EndOfContent, INT2NUM(V_ASN1_EOC)); rb_hash_aset(class_tag_map, cASN1Boolean, INT2NUM(V_ASN1_BOOLEAN)); rb_hash_aset(class_tag_map, cASN1Integer, INT2NUM(V_ASN1_INTEGER)); diff --git a/test/openssl/test_asn1.rb b/test/openssl/test_asn1.rb index 1170703..ad76f07 100644 --- a/test/openssl/test_asn1.rb +++ b/test/openssl/test_asn1.rb @@ -635,6 +635,11 @@ class OpenSSL::TestASN1 < OpenSSL::TestCase https://github.com/ruby/ruby/blob/trunk/test/openssl/test_asn1.rb#L635 assert_equal data, seq.entries end + def test_gc_stress + skip "very time consuming test" + assert_ruby_status([{"RUBY_DEBUG"=>"gc_stress"}, "--disable-gems", "-ropenssl", "-eexit"], timeout: 20) + end + private def B(ary) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/