From: mame@... Date: 2019-04-10T07:56:14+00:00 Subject: [ruby-core:92231] [Ruby trunk Bug#15760] OpenSSL::BN.new(nil, 2) dumps core Issue #15760 has been reported by mame (Yusuke Endoh). ---------------------------------------- Bug #15760: OpenSSL::BN.new(nil, 2) dumps core https://bugs.ruby-lang.org/issues/15760 * Author: mame (Yusuke Endoh) * Status: Open * Priority: Normal * Assignee: rhenium (Kazuki Yamaguchi) * Target version: * ruby -v: ruby 2.7.0dev (2019-04-10 trunk 67496) [x86_64-linux] * Backport: 2.4: REQUIRED, 2.5: REQUIRED, 2.6: REQUIRED ---------------------------------------- ext/openssl/ossl_bn.c ``` 221 if (!BN_bin2bn((unsigned char *)StringValuePtr(str), RSTRING_LENINT(str), bn)) { 222 ossl_raise(eBNError, NULL); 223 } 224 break; ``` This code depends on the evaluation order of function arguments. It works if `StringValuePtr(str)` is evaluated earlier than RSTRING_LENINT(str), but it doesn't if the order is reversed, which causes core dump. -- https://bugs.ruby-lang.org/ Unsubscribe: