fix_primitive_inf_length.diff

Martin Bosslet, 01/26/2011 09:35 AM

Download (1.25 KB)

View differences:

ruby/ext/openssl/ossl_asn1.c (working copy)
772 772
	    else value = ossl_asn1_decode0(&p, len, &off, depth+1, 0, yield);
773 773
	}
774 774
	else{
775
	    if ((j & 0x01) && (len == 0)) {
776
		ossl_raise(eASN1Error, "Infinite length for primitive value");
777
	    }
775 778
	    value = rb_str_new((const char *)p, len);
776 779
	    p += len;
777 780
	    off += len;
ruby/test/openssl/test_asn1.rb (working copy)
430 430
    end
431 431
  end
432 432
  
433
  def test_primitive_inf_length
434
    assert_raises(OpenSSL::ASN1::ASN1Error) do
435
      spec = %w{ 02 80 02 01 01 00 00 }
436
      raw = [spec.join('')].pack('H*')
437
      OpenSSL::ASN1.decode(raw)
438
    end
439
  end
440
  
433 441
end if defined?(OpenSSL)
442