Bug #5972

OpenSSL::ASN1::GeneralString - double INT2NUM() results in invalid ASN.1 tag

Added by Mantas Mikulėnas about 3 years ago. Updated about 3 years ago.

[ruby-core:42358]
Status:Closed
Priority:Normal
Assignee:Martin Bosslet
ruby -v:ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux] Backport:

Description

In ext/openssl/ossl_asn1.c, INT2NUM() is being called twice for V_ASN1_GENERALSTRING:

rb_hash_aset(class_tag_map, cASN1GeneralString, INT2NUM(INT2NUM(V_ASN1_GENERALSTRING)));

This causes OpenSSL::ASN1::GeneralString.new to return "unsupported ASN.1 type":

$ irb -ropenssl
irb > OpenSSL::ASN1::GeneralString.new("foo").to_der
OpenSSL::ASN1::ASN1Error: unsupported ASN.1 type
from (irb):1:in to_der'
from (irb):1
from /usr/bin/irb:12:in
'
irb >

Expected result:

$ irb -ropenssl
irb > OpenSSL::ASN1::GeneralString.new("foo").to_der
=> "\e\x03foo"
irb >

Patch attached.

ruby-1.9.3-p0-openssl-generalstring.patch Magnifier - Patch (914 Bytes) Mantas Mikulėnas, 02/05/2012 10:29 PM

Associated revisions

Revision 34469
Added by emboss about 3 years ago

  • ext/openssl/ossl_asn1.c: Call INT2NUM only once for GeneralString. Thanks to Mantas Mikulenas for noticing and providing a patch! [Bug #5972]

Revision 34469
Added by emboss about 3 years ago

  • ext/openssl/ossl_asn1.c: Call INT2NUM only once for GeneralString. Thanks to Mantas Mikulenas for noticing and providing a patch! [Bug #5972]

History

#1 Updated by Martin Bosslet about 3 years ago

  • Assignee set to Martin Bosslet
  • Target version set to 2.0.0

#2 Updated by Anonymous about 3 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r34469.
Mantas, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ext/openssl/ossl_asn1.c: Call INT2NUM only once for GeneralString. Thanks to Mantas Mikulenas for noticing and providing a patch! [Bug #5972]

Also available in: Atom PDF