Project

General

Profile

Bug #13170

OpenSSL::X509::Name#eql? broken in Ruby 2.4.0

Added by Iristyle (Ethan Brown) almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin15]
[ruby-core:79310]

Description

Previously the behavior in Ruby 2.3.1 and earlier was:

[1] pry(main)> OpenSSL::X509::Name.new([['CN', 'foo']]).eql?(OpenSSL::X509::Name.new([['CN', 'bar']]))
=> false
[2] pry(main)> OpenSSL::X509::Name.new([['CN', 'foo']]).eql?(OpenSSL::X509::Name.new([['CN', 'foo']]))
=> true
[3] pry(main)> RUBY_VERSION
=> "2.3.1"

In Ruby 2.4.0, the evaluation is backwards:

[1] pry(main)> OpenSSL::X509::Name.new([['CN', 'foo']]).eql?(OpenSSL::X509::Name.new([['CN', 'bar']]))
=> true
[2] pry(main)> OpenSSL::X509::Name.new([['CN', 'foo']]).eql?(OpenSSL::X509::Name.new([['CN', 'foo']]))
=> false
[3] pry(main)> RUBY_VERSION
=> "2.4.0"

This is due to the implementation of the function at https://github.com/ruby/ruby/blob/aab0d67a1ff5190ff7a951e40cee742210302aed/ext/openssl/ossl_x509name.c#L366-L379

static VALUE ossl_x509name_eql(VALUE self, VALUE other)

Previously in 2.3.1 code returned (based on result = ossl_x509name_cmp0(self, other);):

return (result == 0) ? Qtrue : Qfalse;

Now the code has introduced a logic bug in 2.4.0 as of commit https://github.com/ruby/ruby/commit/aab0d67a1ff5190ff7a951e40cee742210302aed:

return ossl_x509name_cmp0(self, other) ? Qtrue : Qfalse;

The code should be:

return (ossl_x509name_cmp0(self, other) == 0) ? Qtrue : Qfalse;

Associated revisions

Revision 8795838f
Added by rhe almost 3 years ago

openssl: import v2.0.3

Import Ruby/OpenSSL 2.0.3. Only bugfixes. The full commit log since
2.0.2 (imported at r57146) can be found at:

https://github.com/ruby/openssl/compare/v2.0.2...v2.0.3


Corey Bonnell (1):
Fix for ASN1::Constructive 'each' implementation

Kazuki Yamaguchi (10):
Fix build with static OpenSSL libraries on Windows
([ruby-core:78878] [Bug #13080])
Merge pull request #96 from CBonnell/master
Merge branch 'topic/windows-static-linking-without-pkg-config' into maint
appveyor.yml: update OpenSSL version to 1.0.2j
buffering: fix typo in doc
test/envutil: fix assert_raise_with_message
x509: fix OpenSSL::X509::Name#eql?
([ruby-core:79310] [Bug #13170])
ruby-openssl-docker: update versions of Ruby and OpenSSL
.travis.yml: test with Ruby 2.4
Ruby/OpenSSL 2.0.3

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

Revision 57482
Added by rhenium (Kazuki Yamaguchi) almost 3 years ago

openssl: import v2.0.3

Import Ruby/OpenSSL 2.0.3. Only bugfixes. The full commit log since
2.0.2 (imported at r57146) can be found at:

https://github.com/ruby/openssl/compare/v2.0.2...v2.0.3


Corey Bonnell (1):
Fix for ASN1::Constructive 'each' implementation

Kazuki Yamaguchi (10):
Fix build with static OpenSSL libraries on Windows
([ruby-core:78878] [Bug #13080])
Merge pull request #96 from CBonnell/master
Merge branch 'topic/windows-static-linking-without-pkg-config' into maint
appveyor.yml: update OpenSSL version to 1.0.2j
buffering: fix typo in doc
test/envutil: fix assert_raise_with_message
x509: fix OpenSSL::X509::Name#eql?
([ruby-core:79310] [Bug #13170])
ruby-openssl-docker: update versions of Ruby and OpenSSL
.travis.yml: test with Ruby 2.4
Ruby/OpenSSL 2.0.3

Revision 57482
Added by rhe almost 3 years ago

openssl: import v2.0.3

Import Ruby/OpenSSL 2.0.3. Only bugfixes. The full commit log since
2.0.2 (imported at r57146) can be found at:

https://github.com/ruby/openssl/compare/v2.0.2...v2.0.3


Corey Bonnell (1):
Fix for ASN1::Constructive 'each' implementation

Kazuki Yamaguchi (10):
Fix build with static OpenSSL libraries on Windows
([ruby-core:78878] [Bug #13080])
Merge pull request #96 from CBonnell/master
Merge branch 'topic/windows-static-linking-without-pkg-config' into maint
appveyor.yml: update OpenSSL version to 1.0.2j
buffering: fix typo in doc
test/envutil: fix assert_raise_with_message
x509: fix OpenSSL::X509::Name#eql?
([ruby-core:79310] [Bug #13170])
ruby-openssl-docker: update versions of Ruby and OpenSSL
.travis.yml: test with Ruby 2.4
Ruby/OpenSSL 2.0.3

Revision 57482
Added by rhe almost 3 years ago

openssl: import v2.0.3

Import Ruby/OpenSSL 2.0.3. Only bugfixes. The full commit log since
2.0.2 (imported at r57146) can be found at:

https://github.com/ruby/openssl/compare/v2.0.2...v2.0.3


Corey Bonnell (1):
Fix for ASN1::Constructive 'each' implementation

Kazuki Yamaguchi (10):
Fix build with static OpenSSL libraries on Windows
([ruby-core:78878] [Bug #13080])
Merge pull request #96 from CBonnell/master
Merge branch 'topic/windows-static-linking-without-pkg-config' into maint
appveyor.yml: update OpenSSL version to 1.0.2j
buffering: fix typo in doc
test/envutil: fix assert_raise_with_message
x509: fix OpenSSL::X509::Name#eql?
([ruby-core:79310] [Bug #13170])
ruby-openssl-docker: update versions of Ruby and OpenSSL
.travis.yml: test with Ruby 2.4
Ruby/OpenSSL 2.0.3

Revision c1478b66
Added by naruse (Yui NARUSE) over 2 years ago

merge revision(s) 57482: [Backport #13080] [Backport #13170]

    openssl: import v2.0.3

    Import Ruby/OpenSSL 2.0.3. Only bugfixes. The full commit log since
    2.0.2 (imported at r57146) can be found at:

      https://github.com/ruby/openssl/compare/v2.0.2...v2.0.3

    ----------------------------------------------------------------
    Corey Bonnell (1):
          Fix for ASN1::Constructive 'each' implementation

    Kazuki Yamaguchi (10):
          Fix build with static OpenSSL libraries on Windows
           ([ruby-core:78878] [Bug #13080])
          Merge pull request #96 from CBonnell/master
          Merge branch 'topic/windows-static-linking-without-pkg-config' into maint
          appveyor.yml: update OpenSSL version to 1.0.2j
          buffering: fix typo in doc
          test/envutil: fix assert_raise_with_message
          x509: fix OpenSSL::X509::Name#eql?
           ([ruby-core:79310] [Bug #13170])
          ruby-openssl-docker: update versions of Ruby and OpenSSL
          .travis.yml: test with Ruby 2.4
          Ruby/OpenSSL 2.0.3

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

Revision 57881
Added by naruse (Yui NARUSE) over 2 years ago

merge revision(s) 57482: [Backport #13080] [Backport #13170]

openssl: import v2.0.3

Import Ruby/OpenSSL 2.0.3. Only bugfixes. The full commit log since
2.0.2 (imported at r57146) can be found at:

  https://github.com/ruby/openssl/compare/v2.0.2...v2.0.3

----------------------------------------------------------------
Corey Bonnell (1):
      Fix for ASN1::Constructive 'each' implementation

Kazuki Yamaguchi (10):
      Fix build with static OpenSSL libraries on Windows
       ([ruby-core:78878] [Bug #13080])
      Merge pull request #96 from CBonnell/master
      Merge branch 'topic/windows-static-linking-without-pkg-config' into maint
      appveyor.yml: update OpenSSL version to 1.0.2j
      buffering: fix typo in doc
      test/envutil: fix assert_raise_with_message
      x509: fix OpenSSL::X509::Name#eql?
       ([ruby-core:79310] [Bug #13170])
      ruby-openssl-docker: update versions of Ruby and OpenSSL
      .travis.yml: test with Ruby 2.4
      Ruby/OpenSSL 2.0.3

History

Updated by Iristyle (Ethan Brown) almost 3 years ago

  • Description updated (diff)

Updated by Iristyle (Ethan Brown) almost 3 years ago

A colleague has posted a pull request at https://github.com/ruby/openssl/pull/100 fixing this issue.

#4

Updated by Anonymous almost 3 years ago

  • Status changed from Open to Closed

Applied in changeset r57482.


openssl: import v2.0.3

Import Ruby/OpenSSL 2.0.3. Only bugfixes. The full commit log since
2.0.2 (imported at r57146) can be found at:

https://github.com/ruby/openssl/compare/v2.0.2...v2.0.3


Corey Bonnell (1):
Fix for ASN1::Constructive 'each' implementation

Kazuki Yamaguchi (10):
Fix build with static OpenSSL libraries on Windows
([ruby-core:78878] [Bug #13080])
Merge pull request #96 from CBonnell/master
Merge branch 'topic/windows-static-linking-without-pkg-config' into maint
appveyor.yml: update OpenSSL version to 1.0.2j
buffering: fix typo in doc
test/envutil: fix assert_raise_with_message
x509: fix OpenSSL::X509::Name#eql?
([ruby-core:79310] [Bug #13170])
ruby-openssl-docker: update versions of Ruby and OpenSSL
.travis.yml: test with Ruby 2.4
Ruby/OpenSSL 2.0.3

Updated by naruse (Yui NARUSE) over 2 years ago

  • Backport changed from 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN to 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: DONE

ruby_2_4 r57881 merged revision(s) 57482.

Also available in: Atom PDF