[前][次][番号順一覧][スレッド一覧]

ruby-changes:60588

From: usa <ko1@a...>
Date: Tue, 31 Mar 2020 06:38:07 +0900 (JST)
Subject: [ruby-changes:60588] ac6dd2fecc (ruby_2_5): merge revision(s) 203b7fa1ae8cc40d41c38d684f70b3fea7fae813,0131fab749fb76800de09e49a6abf910201c5b58,9c0cd5c569ba22bc68d1a77ad6580a275cd99639,c144d7215b3444fa36d28d540b60170a5b30743d: [Backport #16196]

https://git.ruby-lang.org/ruby.git/commit/?id=ac6dd2fecc

From ac6dd2fecca31cdb6a06cf89eded6c9003ae8af5 Mon Sep 17 00:00:00 2001
From: usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Mon, 30 Mar 2020 21:37:50 +0000
Subject: merge revision(s)
 203b7fa1ae8cc40d41c38d684f70b3fea7fae813,0131fab749fb76800de09e49a6abf910201c5b58,9c0cd5c569ba22bc68d1a77ad6580a275cd99639,c144d7215b3444fa36d28d540b60170a5b30743d:
 [Backport #16196]

	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]

	Slimed down test runtime by stressing openssl.so only [Bug #16196]


	Prefer rb_gc_register_mark_object

	* ext/openssl/ossl_asn1.c (Init_ossl_asn1): prefer
	  `rb_gc_register_mark_object`, which is better for constant
	  objects, over `rb_gc_register_address` for global/static
	  variables which can be re-assigned at runtime.  [Bug #16196]

	Skip very time consuming test [Bug #16196]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c
index 7b6c973..3c048ab 100644
--- a/ext/openssl/ossl_asn1.c
+++ b/ext/openssl/ossl_asn1.c
@@ -1824,6 +1824,7 @@ do{\ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_asn1.c#L1824
     rb_define_method(cASN1EndOfContent, "to_der", ossl_asn1eoc_to_der, 0);
 
     class_tag_map = rb_hash_new();
+    rb_gc_register_mark_object(class_tag_map);
     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..cc11301 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(['--disable-gems', '-eGC.stress=true', '-erequire "openssl.so"'])
+  end
+
   private
 
   def B(ary)
diff --git a/version.h b/version.h
index 97b187b..9fca24e 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L1
 #define RUBY_VERSION "2.5.8"
 #define RUBY_RELEASE_DATE "2020-03-31"
-#define RUBY_PATCHLEVEL 212
+#define RUBY_PATCHLEVEL 213
 
 #define RUBY_RELEASE_YEAR 2020
 #define RUBY_RELEASE_MONTH 3
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]