summaryrefslogtreecommitdiff
path: root/ext/openssl
diff options
context:
space:
mode:
Diffstat (limited to 'ext/openssl')
-rw-r--r--ext/openssl/ossl_asn1.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c
index b67decc5f3..44c19b9795 100644
--- a/ext/openssl/ossl_asn1.c
+++ b/ext/openssl/ossl_asn1.c
@@ -772,6 +772,9 @@ ossl_asn1_decode0(unsigned char **pp, long length, long *offset, long depth,
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;