crypto/asn1/t_x509.c:134: error: INTEGER_OVERFLOW_L2
  ([-9223372036854775808, 9223372036854775807] + 1):signed64.
Showing all 5 steps of the trace


crypto/asn1/t_x509.c:133:13: <LHS trace>
131.       }
132.       if (!(cflag & X509_FLAG_NO_VERSION)) {
133.           l = X509_get_version(x);
                   ^
134.           if (BIO_printf(bp, "%8sVersion: %lu (0x%lx)\n", "", l + 1, l) <= 0)
135.               goto err;

crypto/asn1/t_x509.c:133:13: Call
131.       }
132.       if (!(cflag & X509_FLAG_NO_VERSION)) {
133.           l = X509_get_version(x);
                   ^
134.           if (BIO_printf(bp, "%8sVersion: %lu (0x%lx)\n", "", l + 1, l) <= 0)
135.               goto err;

crypto/asn1/a_int.c:613:9: Assignment
  611.       int64_t r;
  612.       if (a == NULL)
  613.           return 0;
                 ^
  614.       i = ASN1_INTEGER_get_int64(&r, a);
  615.       if (i == 0)

crypto/asn1/t_x509.c:133:9: Assignment
131.       }
132.       if (!(cflag & X509_FLAG_NO_VERSION)) {
133.           l = X509_get_version(x);
               ^
134.           if (BIO_printf(bp, "%8sVersion: %lu (0x%lx)\n", "", l + 1, l) <= 0)
135.               goto err;

crypto/asn1/t_x509.c:134:13: Binary operation: ([-9223372036854775808, 9223372036854775807] + 1):signed64
132.       if (!(cflag & X509_FLAG_NO_VERSION)) {
133.           l = X509_get_version(x);
134.           if (BIO_printf(bp, "%8sVersion: %lu (0x%lx)\n", "", l + 1, l) <= 0)
                   ^
135.               goto err;
136.       }

int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags,
                  unsigned long cflag)
{
    long l;
    int ret = 0, i;
    char *m = NULL, mlch = ' ';
    int nmindent = 0;
    X509_CINF *ci;
    ASN1_INTEGER *bs;
    EVP_PKEY *pkey = NULL;
    const char *neg;
    if ((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
        mlch = '\n';
        nmindent = 12;
    }
    if (nmflags == X509_FLAG_COMPAT)
        nmindent = 16;
    ci = x->cert_info;
    if (!(cflag & X509_FLAG_NO_HEADER)) {
        if (BIO_write(bp, "Certificate:\n", 13) <= 0)
            goto err;
        if (BIO_write(bp, "    Data:\n", 10) <= 0)
            goto err;
    }
    if (!(cflag & X509_FLAG_NO_VERSION)) {
        l = X509_get_version(x);
        if (BIO_printf(bp, "%8sVersion: %lu (0x%lx)\n", "", l + 1, l) <= 0)
            goto err;
    }
    if (!(cflag & X509_FLAG_NO_SERIAL)) {
        if (BIO_write(bp, "        Serial Number:", 22) <= 0)
            goto err;
        bs = X509_get_serialNumber(x);
        if (bs->length <= (int)sizeof(long)) {
                ERR_set_mark();
                l = ASN1_INTEGER_get(bs);
                ERR_pop_to_mark();
        } else {
            l = -1;
        }
        if (l != -1) {
            if (bs->type == V_ASN1_NEG_INTEGER) {
                l = -l;
                neg = "-";
            } else
                neg = "";
            if (BIO_printf(bp, " %s%lu (%s0x%lx)\n", neg, l, neg, l) <= 0)
                goto err;
        } else {
            neg = (bs->type == V_ASN1_NEG_INTEGER) ? " (Negative)" : "";
            if (BIO_printf(bp, "\n%12s%s", "", neg) <= 0)
                goto err;
            for (i = 0; i < bs->length; i++) {
                if (BIO_printf(bp, "%02x%c", bs->data[i],
                               ((i + 1 == bs->length) ? '\n' : ':')) <= 0)
                    goto err;
            }
        }
    }
    if (!(cflag & X509_FLAG_NO_SIGNAME)) {
        if (X509_signature_print(bp, ci->signature, NULL) <= 0)
            goto err;
    }
    if (!(cflag & X509_FLAG_NO_ISSUER)) {
        if (BIO_printf(bp, "        Issuer:%c", mlch) <= 0)
            goto err;
        if (X509_NAME_print_ex(bp, X509_get_issuer_name(x), nmindent, nmflags)
            < 0)
            goto err;
        if (BIO_write(bp, "\n", 1) <= 0)
            goto err;
    }
    if (!(cflag & X509_FLAG_NO_VALIDITY)) {
        if (BIO_write(bp, "        Validity\n", 17) <= 0)
            goto err;
        if (BIO_write(bp, "            Not Before: ", 24) <= 0)
            goto err;
        if (!ASN1_TIME_print(bp, X509_get_notBefore(x)))
            goto err;
        if (BIO_write(bp, "\n            Not After : ", 25) <= 0)
            goto err;
        if (!ASN1_TIME_print(bp, X509_get_notAfter(x)))
            goto err;
        if (BIO_write(bp, "\n", 1) <= 0)
            goto err;
    }
    if (!(cflag & X509_FLAG_NO_SUBJECT)) {
        if (BIO_printf(bp, "        Subject:%c", mlch) <= 0)
            goto err;
        if (X509_NAME_print_ex
            (bp, X509_get_subject_name(x), nmindent, nmflags) < 0)
            goto err;
        if (BIO_write(bp, "\n", 1) <= 0)
            goto err;
    }
    if (!(cflag & X509_FLAG_NO_PUBKEY)) {
        if (BIO_write(bp, "        Subject Public Key Info:\n", 33) <= 0)
            goto err;
        if (BIO_printf(bp, "%12sPublic Key Algorithm: ", "") <= 0)
            goto err;
        if (i2a_ASN1_OBJECT(bp, ci->key->algor->algorithm) <= 0)
            goto err;
        if (BIO_puts(bp, "\n") <= 0)
            goto err;
        pkey = X509_get_pubkey(x);
        if (pkey == NULL) {
            BIO_printf(bp, "%12sUnable to load Public Key\n", "");
            ERR_print_errors(bp);
        } else {
            EVP_PKEY_print_public(bp, pkey, 16, NULL);
            EVP_PKEY_free(pkey);
        }
    }
    if (!(cflag & X509_FLAG_NO_IDS)) {
        if (ci->issuerUID) {
            if (BIO_printf(bp, "%8sIssuer Unique ID: ", "") <= 0)
                goto err;
            if (!X509_signature_dump(bp, ci->issuerUID, 12))
                goto err;
        }
        if (ci->subjectUID) {
            if (BIO_printf(bp, "%8sSubject Unique ID: ", "") <= 0)
                goto err;
            if (!X509_signature_dump(bp, ci->subjectUID, 12))
                goto err;
        }
    }
    if (!(cflag & X509_FLAG_NO_EXTENSIONS))
        X509V3_extensions_print(bp, "X509v3 extensions",
                                ci->extensions, cflag, 8);
    if (!(cflag & X509_FLAG_NO_SIGDUMP)) {
        if (X509_signature_print(bp, x->sig_alg, x->signature) <= 0)
            goto err;
    }
    if (!(cflag & X509_FLAG_NO_AUX)) {
        if (!X509_CERT_AUX_print(bp, x->aux, 0))
            goto err;
    }
    ret = 1;
 err:
    OPENSSL_free(m);
    return (ret);
}
['int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags,\n                  unsigned long cflag)\n{\n    long l;\n    int ret = 0, i;\n    char *m = NULL, mlch = \' \';\n    int nmindent = 0;\n    X509_CINF *ci;\n    ASN1_INTEGER *bs;\n    EVP_PKEY *pkey = NULL;\n    const char *neg;\n    if ((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {\n        mlch = \'\\n\';\n        nmindent = 12;\n    }\n    if (nmflags == X509_FLAG_COMPAT)\n        nmindent = 16;\n    ci = x->cert_info;\n    if (!(cflag & X509_FLAG_NO_HEADER)) {\n        if (BIO_write(bp, "Certificate:\\n", 13) <= 0)\n            goto err;\n        if (BIO_write(bp, "    Data:\\n", 10) <= 0)\n            goto err;\n    }\n    if (!(cflag & X509_FLAG_NO_VERSION)) {\n        l = X509_get_version(x);\n        if (BIO_printf(bp, "%8sVersion: %lu (0x%lx)\\n", "", l + 1, l) <= 0)\n            goto err;\n    }\n    if (!(cflag & X509_FLAG_NO_SERIAL)) {\n        if (BIO_write(bp, "        Serial Number:", 22) <= 0)\n            goto err;\n        bs = X509_get_serialNumber(x);\n        if (bs->length <= (int)sizeof(long)) {\n                ERR_set_mark();\n                l = ASN1_INTEGER_get(bs);\n                ERR_pop_to_mark();\n        } else {\n            l = -1;\n        }\n        if (l != -1) {\n            if (bs->type == V_ASN1_NEG_INTEGER) {\n                l = -l;\n                neg = "-";\n            } else\n                neg = "";\n            if (BIO_printf(bp, " %s%lu (%s0x%lx)\\n", neg, l, neg, l) <= 0)\n                goto err;\n        } else {\n            neg = (bs->type == V_ASN1_NEG_INTEGER) ? " (Negative)" : "";\n            if (BIO_printf(bp, "\\n%12s%s", "", neg) <= 0)\n                goto err;\n            for (i = 0; i < bs->length; i++) {\n                if (BIO_printf(bp, "%02x%c", bs->data[i],\n                               ((i + 1 == bs->length) ? \'\\n\' : \':\')) <= 0)\n                    goto err;\n            }\n        }\n    }\n    if (!(cflag & X509_FLAG_NO_SIGNAME)) {\n        if (X509_signature_print(bp, ci->signature, NULL) <= 0)\n            goto err;\n    }\n    if (!(cflag & X509_FLAG_NO_ISSUER)) {\n        if (BIO_printf(bp, "        Issuer:%c", mlch) <= 0)\n            goto err;\n        if (X509_NAME_print_ex(bp, X509_get_issuer_name(x), nmindent, nmflags)\n            < 0)\n            goto err;\n        if (BIO_write(bp, "\\n", 1) <= 0)\n            goto err;\n    }\n    if (!(cflag & X509_FLAG_NO_VALIDITY)) {\n        if (BIO_write(bp, "        Validity\\n", 17) <= 0)\n            goto err;\n        if (BIO_write(bp, "            Not Before: ", 24) <= 0)\n            goto err;\n        if (!ASN1_TIME_print(bp, X509_get_notBefore(x)))\n            goto err;\n        if (BIO_write(bp, "\\n            Not After : ", 25) <= 0)\n            goto err;\n        if (!ASN1_TIME_print(bp, X509_get_notAfter(x)))\n            goto err;\n        if (BIO_write(bp, "\\n", 1) <= 0)\n            goto err;\n    }\n    if (!(cflag & X509_FLAG_NO_SUBJECT)) {\n        if (BIO_printf(bp, "        Subject:%c", mlch) <= 0)\n            goto err;\n        if (X509_NAME_print_ex\n            (bp, X509_get_subject_name(x), nmindent, nmflags) < 0)\n            goto err;\n        if (BIO_write(bp, "\\n", 1) <= 0)\n            goto err;\n    }\n    if (!(cflag & X509_FLAG_NO_PUBKEY)) {\n        if (BIO_write(bp, "        Subject Public Key Info:\\n", 33) <= 0)\n            goto err;\n        if (BIO_printf(bp, "%12sPublic Key Algorithm: ", "") <= 0)\n            goto err;\n        if (i2a_ASN1_OBJECT(bp, ci->key->algor->algorithm) <= 0)\n            goto err;\n        if (BIO_puts(bp, "\\n") <= 0)\n            goto err;\n        pkey = X509_get_pubkey(x);\n        if (pkey == NULL) {\n            BIO_printf(bp, "%12sUnable to load Public Key\\n", "");\n            ERR_print_errors(bp);\n        } else {\n            EVP_PKEY_print_public(bp, pkey, 16, NULL);\n            EVP_PKEY_free(pkey);\n        }\n    }\n    if (!(cflag & X509_FLAG_NO_IDS)) {\n        if (ci->issuerUID) {\n            if (BIO_printf(bp, "%8sIssuer Unique ID: ", "") <= 0)\n                goto err;\n            if (!X509_signature_dump(bp, ci->issuerUID, 12))\n                goto err;\n        }\n        if (ci->subjectUID) {\n            if (BIO_printf(bp, "%8sSubject Unique ID: ", "") <= 0)\n                goto err;\n            if (!X509_signature_dump(bp, ci->subjectUID, 12))\n                goto err;\n        }\n    }\n    if (!(cflag & X509_FLAG_NO_EXTENSIONS))\n        X509V3_extensions_print(bp, "X509v3 extensions",\n                                ci->extensions, cflag, 8);\n    if (!(cflag & X509_FLAG_NO_SIGDUMP)) {\n        if (X509_signature_print(bp, x->sig_alg, x->signature) <= 0)\n            goto err;\n    }\n    if (!(cflag & X509_FLAG_NO_AUX)) {\n        if (!X509_CERT_AUX_print(bp, x->aux, 0))\n            goto err;\n    }\n    ret = 1;\n err:\n    OPENSSL_free(m);\n    return (ret);\n}', 'long ASN1_INTEGER_get(const ASN1_INTEGER *a)\n{\n    int i;\n    int64_t r;\n    if (a == NULL)\n        return 0;\n    i = ASN1_INTEGER_get_int64(&r, a);\n    if (i == 0)\n        return -1;\n    if (r > LONG_MAX || r < LONG_MIN)\n        return -1;\n    return (long)r;\n}']