diff --git a/crypto/x509/v3_sxnet.c b/crypto/x509/v3_sxnet.c index 76f5eafc73dd50615f5afc0ec5b32275baddb522..6e2b796a3816869ab795d7f74ff4669aa28ada15 100644 --- a/crypto/x509/v3_sxnet.c +++ b/crypto/x509/v3_sxnet.c @@ -57,12 +57,24 @@ IMPLEMENT_ASN1_FUNCTIONS(SXNET) static int sxnet_i2r(X509V3_EXT_METHOD *method, SXNET *sx, BIO *out, int indent) { - long v; + int64_t v; char *tmp; SXNETID *id; int i; - v = ASN1_INTEGER_get(sx->version); - BIO_printf(out, "%*sVersion: %ld (0x%lX)", indent, "", v + 1, v); + + /* + * Since we add 1 to the version number to display it, we don't support + * LONG_MAX since that would cause on overflow. + */ + if (!ASN1_INTEGER_get_int64(&v, sx->version) + || v >= LONG_MAX + || v < LONG_MIN) { + BIO_printf(out, "%*sVersion: ", indent, ""); + } else { + long vl = (long)v; + + BIO_printf(out, "%*sVersion: %ld (0x%lX)", indent, "", vl + 1, vl); + } for (i = 0; i < sk_SXNETID_num(sx->ids); i++) { id = sk_SXNETID_value(sx->ids, i); tmp = i2s_ASN1_INTEGER(NULL, id->zone); diff --git a/fuzz/corpora/crl/4d72381f46c50eb9cabd8aa27f456962bf013b28 b/fuzz/corpora/crl/4d72381f46c50eb9cabd8aa27f456962bf013b28 new file mode 100644 index 0000000000000000000000000000000000000000..dde1c66748206b4349d83a3e5f1839e04f0a966a Binary files /dev/null and b/fuzz/corpora/crl/4d72381f46c50eb9cabd8aa27f456962bf013b28 differ