apps/ciphers.c:264: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned64 by call to `SSL_free`.
Showing all 14 steps of the trace


apps/ciphers.c:264:5: Call
262.           sk_SSL_CIPHER_free(sk);
263.       SSL_CTX_free(ctx);
264.       SSL_free(ssl);
           ^
265.       return ret;
266.   }

ssl/ssl_lib.c:1138:1: Parameter `s->session_ctx->sessions->num_items`
  1136.   }
  1137.   
  1138. > void SSL_free(SSL *s)
  1139.   {
  1140.       int i;

ssl/ssl_lib.c:1173:9: Call
  1171.       /* Make the next call work :-) */
  1172.       if (s->session != NULL) {
  1173.           ssl_clear_bad_session(s);
                  ^
  1174.           SSL_SESSION_free(s->session);
  1175.       }

ssl/ssl_sess.c:1124:1: Parameter `s->session_ctx->sessions->num_items`
    1122.   }
    1123.   
    1124. > int ssl_clear_bad_session(SSL *s)
    1125.   {
    1126.       if ((s->session != NULL) &&

ssl/ssl_sess.c:1129:9: Call
    1127.           !(s->shutdown & SSL_SENT_SHUTDOWN) &&
    1128.           !(SSL_in_init(s) || SSL_in_before(s))) {
    1129.           SSL_CTX_remove_session(s->session_ctx, s->session);
                    ^
    1130.           return 1;
    1131.       } else

ssl/ssl_sess.c:742:1: Parameter `ctx->sessions->num_items`
      740.   }
      741.   
      742. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
      743.   {
      744.       return remove_session_lock(ctx, c, 1);

ssl/ssl_sess.c:744:12: Call
      742.   int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
      743.   {
      744.       return remove_session_lock(ctx, c, 1);
                        ^
      745.   }
      746.   

ssl/ssl_sess.c:747:1: Parameter `ctx->sessions->num_items`
        745.   }
        746.   
        747. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
        748.   {
        749.       SSL_SESSION *r;

ssl/ssl_sess.c:757:17: Call
        755.           if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) != NULL) {
        756.               ret = 1;
        757.               r = lh_SSL_SESSION_delete(ctx->sessions, r);
                               ^
        758.               SSL_SESSION_list_remove(ctx, r);
        759.           }

ssl/ssl_locl.h:735:1: Parameter `lh->num_items`
          733.   } TLSEXT_INDEX;
          734.   
          735. > DEFINE_LHASH_OF(SSL_SESSION);
          736.   /* Needed in ssl_cert.c */
          737.   DEFINE_LHASH_OF(X509_NAME);

ssl/ssl_locl.h:735:1: Call
          733.   } TLSEXT_INDEX;
          734.   
          735. > DEFINE_LHASH_OF(SSL_SESSION);
          736.   /* Needed in ssl_cert.c */
          737.   DEFINE_LHASH_OF(X509_NAME);

crypto/lhash/lhash.c:137:1: <LHS trace>
135.   }
136.   
137. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
138.   {
139.       unsigned long hash;

crypto/lhash/lhash.c:137:1: Parameter `lh->num_items`
            135.   }
            136.   
            137. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
            138.   {
            139.       unsigned long hash;

crypto/lhash/lhash.c:157:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free` 
            155.       }
            156.   
            157.       lh->num_items--;
                       ^
            158.       if ((lh->num_nodes > MIN_NODES) &&
            159.           (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))

void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
{
    unsigned long hash;
    OPENSSL_LH_NODE *nn, **rn;
    void *ret;
    lh->error = 0;
    rn = getrn(lh, data, &hash);
    if (*rn == NULL) {
        lh->num_no_delete++;
        return NULL;
    } else {
        nn = *rn;
        *rn = nn->next;
        ret = nn->data;
        OPENSSL_free(nn);
        lh->num_delete++;
    }
    lh->num_items--;
    if ((lh->num_nodes > MIN_NODES) &&
        (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
        contract(lh);
    return ret;
}
['int ciphers_main(int argc, char **argv)\n{\n    SSL_CTX *ctx = NULL;\n    SSL *ssl = NULL;\n    STACK_OF(SSL_CIPHER) *sk = NULL;\n    const SSL_METHOD *meth = TLS_server_method();\n    int ret = 1, i, verbose = 0, Verbose = 0, use_supported = 0;\n    int stdname = 0;\n#ifndef OPENSSL_NO_PSK\n    int psk = 0;\n#endif\n#ifndef OPENSSL_NO_SRP\n    int srp = 0;\n#endif\n    const char *p;\n    char *ciphers = NULL, *prog, *convert = NULL, *ciphersuites = NULL;\n    char buf[512];\n    OPTION_CHOICE o;\n    int min_version = 0, max_version = 0;\n    prog = opt_init(argc, argv, ciphers_options);\n    while ((o = opt_next()) != OPT_EOF) {\n        switch (o) {\n        case OPT_EOF:\n        case OPT_ERR:\n opthelp:\n            BIO_printf(bio_err, "%s: Use -help for summary.\\n", prog);\n            goto end;\n        case OPT_HELP:\n            opt_help(ciphers_options);\n            ret = 0;\n            goto end;\n        case OPT_V:\n            verbose = 1;\n            break;\n        case OPT_UPPER_V:\n            verbose = Verbose = 1;\n            break;\n        case OPT_S:\n            use_supported = 1;\n            break;\n        case OPT_STDNAME:\n            stdname = verbose = 1;\n            break;\n        case OPT_CONVERT:\n            convert = opt_arg();\n            break;\n        case OPT_SSL3:\n            min_version = SSL3_VERSION;\n            max_version = SSL3_VERSION;\n            break;\n        case OPT_TLS1:\n            min_version = TLS1_VERSION;\n            max_version = TLS1_VERSION;\n            break;\n        case OPT_TLS1_1:\n            min_version = TLS1_1_VERSION;\n            max_version = TLS1_1_VERSION;\n            break;\n        case OPT_TLS1_2:\n            min_version = TLS1_2_VERSION;\n            max_version = TLS1_2_VERSION;\n            break;\n        case OPT_TLS1_3:\n            min_version = TLS1_3_VERSION;\n            max_version = TLS1_3_VERSION;\n            break;\n        case OPT_PSK:\n#ifndef OPENSSL_NO_PSK\n            psk = 1;\n#endif\n            break;\n        case OPT_SRP:\n#ifndef OPENSSL_NO_SRP\n            srp = 1;\n#endif\n            break;\n        case OPT_CIPHERSUITES:\n            ciphersuites = opt_arg();\n            break;\n        }\n    }\n    argv = opt_rest();\n    argc = opt_num_rest();\n    if (argc == 1)\n        ciphers = *argv;\n    else if (argc != 0)\n        goto opthelp;\n    if (convert != NULL) {\n        BIO_printf(bio_out, "OpenSSL cipher name: %s\\n",\n                   OPENSSL_cipher_name(convert));\n        goto end;\n    }\n    ctx = SSL_CTX_new(meth);\n    if (ctx == NULL)\n        goto err;\n    if (SSL_CTX_set_min_proto_version(ctx, min_version) == 0)\n        goto err;\n    if (SSL_CTX_set_max_proto_version(ctx, max_version) == 0)\n        goto err;\n#ifndef OPENSSL_NO_PSK\n    if (psk)\n        SSL_CTX_set_psk_client_callback(ctx, dummy_psk);\n#endif\n#ifndef OPENSSL_NO_SRP\n    if (srp)\n        SSL_CTX_set_srp_client_pwd_callback(ctx, dummy_srp);\n#endif\n    if (ciphersuites != NULL && !SSL_CTX_set_ciphersuites(ctx, ciphersuites)) {\n        BIO_printf(bio_err, "Error setting TLSv1.3 ciphersuites\\n");\n        goto err;\n    }\n    if (ciphers != NULL) {\n        if (!SSL_CTX_set_cipher_list(ctx, ciphers)) {\n            BIO_printf(bio_err, "Error in cipher list\\n");\n            goto err;\n        }\n    }\n    ssl = SSL_new(ctx);\n    if (ssl == NULL)\n        goto err;\n    if (use_supported)\n        sk = SSL_get1_supported_ciphers(ssl);\n    else\n        sk = SSL_get_ciphers(ssl);\n    if (!verbose) {\n        for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) {\n            const SSL_CIPHER *c = sk_SSL_CIPHER_value(sk, i);\n            p = SSL_CIPHER_get_name(c);\n            if (p == NULL)\n                break;\n            if (i != 0)\n                BIO_printf(bio_out, ":");\n            BIO_printf(bio_out, "%s", p);\n        }\n        BIO_printf(bio_out, "\\n");\n    } else {\n        for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) {\n            const SSL_CIPHER *c;\n            c = sk_SSL_CIPHER_value(sk, i);\n            if (Verbose) {\n                unsigned long id = SSL_CIPHER_get_id(c);\n                int id0 = (int)(id >> 24);\n                int id1 = (int)((id >> 16) & 0xffL);\n                int id2 = (int)((id >> 8) & 0xffL);\n                int id3 = (int)(id & 0xffL);\n                if ((id & 0xff000000L) == 0x03000000L)\n                    BIO_printf(bio_out, "          0x%02X,0x%02X - ", id2, id3);\n                else\n                    BIO_printf(bio_out, "0x%02X,0x%02X,0x%02X,0x%02X - ", id0, id1, id2, id3);\n            }\n            if (stdname) {\n                const char *nm = SSL_CIPHER_standard_name(c);\n                if (nm == NULL)\n                    nm = "UNKNOWN";\n                BIO_printf(bio_out, "%s - ", nm);\n            }\n            BIO_puts(bio_out, SSL_CIPHER_description(c, buf, sizeof(buf)));\n        }\n    }\n    ret = 0;\n    goto end;\n err:\n    ERR_print_errors(bio_err);\n end:\n    if (use_supported)\n        sk_SSL_CIPHER_free(sk);\n    SSL_CTX_free(ctx);\n    SSL_free(ssl);\n    return ret;\n}', 'void SSL_free(SSL *s)\n{\n    int i;\n    if (s == NULL)\n        return;\n    CRYPTO_DOWN_REF(&s->references, &i, s->lock);\n    REF_PRINT_COUNT("SSL", s);\n    if (i > 0)\n        return;\n    REF_ASSERT_ISNT(i < 0);\n    X509_VERIFY_PARAM_free(s->param);\n    dane_final(&s->dane);\n    CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->ex_data);\n    RECORD_LAYER_release(&s->rlayer);\n    ssl_free_wbio_buffer(s);\n    BIO_free_all(s->wbio);\n    s->wbio = NULL;\n    BIO_free_all(s->rbio);\n    s->rbio = NULL;\n    BUF_MEM_free(s->init_buf);\n    sk_SSL_CIPHER_free(s->cipher_list);\n    sk_SSL_CIPHER_free(s->cipher_list_by_id);\n    sk_SSL_CIPHER_free(s->tls13_ciphersuites);\n    if (s->session != NULL) {\n        ssl_clear_bad_session(s);\n        SSL_SESSION_free(s->session);\n    }\n    SSL_SESSION_free(s->psksession);\n    OPENSSL_free(s->psksession_id);\n    clear_ciphers(s);\n    ssl_cert_free(s->cert);\n    OPENSSL_free(s->ext.hostname);\n    SSL_CTX_free(s->session_ctx);\n#ifndef OPENSSL_NO_EC\n    OPENSSL_free(s->ext.ecpointformats);\n    OPENSSL_free(s->ext.supportedgroups);\n#endif\n    sk_X509_EXTENSION_pop_free(s->ext.ocsp.exts, X509_EXTENSION_free);\n#ifndef OPENSSL_NO_OCSP\n    sk_OCSP_RESPID_pop_free(s->ext.ocsp.ids, OCSP_RESPID_free);\n#endif\n#ifndef OPENSSL_NO_CT\n    SCT_LIST_free(s->scts);\n    OPENSSL_free(s->ext.scts);\n#endif\n    OPENSSL_free(s->ext.ocsp.resp);\n    OPENSSL_free(s->ext.alpn);\n    OPENSSL_free(s->ext.tls13_cookie);\n    OPENSSL_free(s->clienthello);\n    OPENSSL_free(s->pha_context);\n    EVP_MD_CTX_free(s->pha_dgst);\n    sk_X509_NAME_pop_free(s->ca_names, X509_NAME_free);\n    sk_X509_NAME_pop_free(s->client_ca_names, X509_NAME_free);\n    sk_X509_pop_free(s->verified_chain, X509_free);\n    if (s->method != NULL)\n        s->method->ssl_free(s);\n    SSL_CTX_free(s->ctx);\n    ASYNC_WAIT_CTX_free(s->waitctx);\n#if !defined(OPENSSL_NO_NEXTPROTONEG)\n    OPENSSL_free(s->ext.npn);\n#endif\n#ifndef OPENSSL_NO_SRTP\n    sk_SRTP_PROTECTION_PROFILE_free(s->srtp_profiles);\n#endif\n    CRYPTO_THREAD_lock_free(s->lock);\n    OPENSSL_free(s);\n}', 'int ssl_clear_bad_session(SSL *s)\n{\n    if ((s->session != NULL) &&\n        !(s->shutdown & SSL_SENT_SHUTDOWN) &&\n        !(SSL_in_init(s) || SSL_in_before(s))) {\n        SSL_CTX_remove_session(s->session_ctx, s->session);\n        return 1;\n    } else\n        return 0;\n}', 'int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)\n{\n    return remove_session_lock(ctx, c, 1);\n}', 'static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)\n{\n    SSL_SESSION *r;\n    int ret = 0;\n    if ((c != NULL) && (c->session_id_length != 0)) {\n        if (lck)\n            CRYPTO_THREAD_write_lock(ctx->lock);\n        if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) != NULL) {\n            ret = 1;\n            r = lh_SSL_SESSION_delete(ctx->sessions, r);\n            SSL_SESSION_list_remove(ctx, r);\n        }\n        c->not_resumable = 1;\n        if (lck)\n            CRYPTO_THREAD_unlock(ctx->lock);\n        if (ctx->remove_session_cb != NULL)\n            ctx->remove_session_cb(ctx, c);\n        if (ret)\n            SSL_SESSION_free(r);\n    } else\n        ret = 0;\n    return ret;\n}', 'DEFINE_LHASH_OF(SSL_SESSION)', 'void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)\n{\n    unsigned long hash;\n    OPENSSL_LH_NODE *nn, **rn;\n    void *ret;\n    lh->error = 0;\n    rn = getrn(lh, data, &hash);\n    if (*rn == NULL) {\n        lh->num_no_delete++;\n        return NULL;\n    } else {\n        nn = *rn;\n        *rn = nn->next;\n        ret = nn->data;\n        OPENSSL_free(nn);\n        lh->num_delete++;\n    }\n    lh->num_items--;\n    if ((lh->num_nodes > MIN_NODES) &&\n        (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))\n        contract(lh);\n    return ret;\n}']