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


test/cipherlist_test.c:247:5: Call
245.       result = 1;
246.   end:
247.       SSL_free(s);
           ^
248.       tear_down(fixture);
249.       return result;

ssl/ssl_lib.c:1145:1: Parameter `s->session_ctx->sessions->num_items`
  1143.   }
  1144.   
  1145. > void SSL_free(SSL *s)
  1146.   {
  1147.       int i;

ssl/ssl_lib.c:1181:9: Call
  1179.       /* Make the next call work :-) */
  1180.       if (s->session != NULL) {
  1181.           ssl_clear_bad_session(s);
                  ^
  1182.           SSL_SESSION_free(s->session);
  1183.       }

ssl/ssl_sess.c:1087:1: Parameter `s->session_ctx->sessions->num_items`
    1085.   }
    1086.   
    1087. > int ssl_clear_bad_session(SSL *s)
    1088.   {
    1089.       if ((s->session != NULL) &&

ssl/ssl_sess.c:1092:9: Call
    1090.           !(s->shutdown & SSL_SENT_SHUTDOWN) &&
    1091.           !(SSL_in_init(s) || SSL_in_before(s))) {
    1092.           SSL_CTX_remove_session(s->session_ctx, s->session);
                    ^
    1093.           return 1;
    1094.       } else

ssl/ssl_sess.c:714:1: Parameter `ctx->sessions->num_items`
      712.   }
      713.   
      714. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
      715.   {
      716.       return remove_session_lock(ctx, c, 1);

ssl/ssl_sess.c:716:12: Call
      714.   int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
      715.   {
      716.       return remove_session_lock(ctx, c, 1);
                        ^
      717.   }
      718.   

ssl/ssl_sess.c:719:1: Parameter `ctx->sessions->num_items`
        717.   }
        718.   
        719. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
        720.   {
        721.       SSL_SESSION *r;

ssl/ssl_sess.c:729:17: Call
        727.           if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) != NULL) {
        728.               ret = 1;
        729.               r = lh_SSL_SESSION_delete(ctx->sessions, r);
                               ^
        730.               SSL_SESSION_list_remove(ctx, r);
        731.           }

ssl/ssl_locl.h:728:1: Parameter `lh->num_items`
          726.   } TLSEXT_INDEX;
          727.   
          728. > DEFINE_LHASH_OF(SSL_SESSION);
          729.   /* Needed in ssl_cert.c */
          730.   DEFINE_LHASH_OF(X509_NAME);

ssl/ssl_locl.h:728:1: Call
          726.   } TLSEXT_INDEX;
          727.   
          728. > DEFINE_LHASH_OF(SSL_SESSION);
          729.   /* Needed in ssl_cert.c */
          730.   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;
}
['static int test_default_cipherlist_clear(void)\n{\n    SETUP_CIPHERLIST_TEST_FIXTURE();\n    SSL *s = NULL;\n    if (fixture == NULL)\n        return 0;\n    if (!TEST_int_eq(SSL_CTX_set_cipher_list(fixture->server, "no-such"), 0))\n        goto end;\n    if (!TEST_int_eq(ERR_GET_REASON(ERR_get_error()), SSL_R_NO_CIPHER_MATCH))\n        goto end;\n    s = SSL_new(fixture->client);\n    if (!TEST_ptr(s))\n      goto end;\n    if (!TEST_int_eq(SSL_set_cipher_list(s, "no-such"), 0))\n        goto end;\n    if (!TEST_int_eq(ERR_GET_REASON(ERR_get_error()),\n                SSL_R_NO_CIPHER_MATCH))\n        goto end;\n    result = 1;\nend:\n    SSL_free(s);\n    tear_down(fixture);\n    return result;\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    sk_SSL_CIPHER_free(s->peer_ciphers);\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->shared_sigalgs);\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.peer_ecpointformats);\n    OPENSSL_free(s->ext.supportedgroups);\n    OPENSSL_free(s->ext.peer_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}']