Bug #4324 ยป fix_primitive_inf_length.diff
ruby/ext/openssl/ossl_asn1.c (working copy) | ||
---|---|---|
else value = ossl_asn1_decode0(&p, len, &off, depth+1, 0, yield);
|
||
}
|
||
else{
|
||
if ((j & 0x01) && (len == 0)) {
|
||
ossl_raise(eASN1Error, "Infinite length for primitive value");
|
||
}
|
||
value = rb_str_new((const char *)p, len);
|
||
p += len;
|
||
off += len;
|
ruby/test/openssl/test_asn1.rb (working copy) | ||
---|---|---|
end
|
||
end
|
||
|
||
def test_primitive_inf_length
|
||
assert_raises(OpenSSL::ASN1::ASN1Error) do
|
||
spec = %w{ 02 80 02 01 01 00 00 }
|
||
raw = [spec.join('')].pack('H*')
|
||
OpenSSL::ASN1.decode(raw)
|
||
end
|
||
end
|
||
|
||
end if defined?(OpenSSL)
|
||