apps/s_server.c:589: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `SSL_set_SSL_CTX`.
Showing all 14 steps of the trace


apps/s_server.c:589:13: Call
587.           if (ctx2) {
588.               BIO_printf(p->biodebug, "Switching server context.\n");
589.               SSL_set_SSL_CTX(s, ctx2);
                   ^
590.           }
591.       }

ssl/ssl_lib.c:3371:1: Parameter `ssl->ctx->sessions->num_nodes`
  3369.   }
  3370.   
  3371. > SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx)
  3372.   {
  3373.       CERT *new_cert;

ssl/ssl_lib.c:3405:5: Call
  3403.   
  3404.       SSL_CTX_up_ref(ctx);
  3405.       SSL_CTX_free(ssl->ctx); /* decrement reference count */
              ^
  3406.       ssl->ctx = ctx;
  3407.   

ssl/ssl_lib.c:2487:1: Parameter `a->sessions->num_nodes`
    2485.   }
    2486.   
    2487. > void SSL_CTX_free(SSL_CTX *a)
    2488.   {
    2489.       int i;

ssl/ssl_lib.c:2513:9: Call
    2511.        */
    2512.       if (a->sessions != NULL)
    2513.           SSL_CTX_flush_sessions(a, 0);
                    ^
    2514.   
    2515.       CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data);

ssl/ssl_sess.c:1061:1: Parameter `s->sessions->num_nodes`
      1059.   IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
      1060.   
      1061. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
      1062.   {
      1063.       unsigned long i;

ssl/ssl_sess.c:1074:5: Call
      1072.       i = CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load;
      1073.       CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load = 0;
      1074.       lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp);
                  ^
      1075.       CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load = i;
      1076.       CRYPTO_THREAD_unlock(s->lock);

ssl/ssl_sess.c:1059:1: Parameter `lh->num_nodes`
        1057.   }
        1058.   
        1059. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
        1060.   
        1061.   void SSL_CTX_flush_sessions(SSL_CTX *s, long t)

ssl/ssl_sess.c:1059:1: Call
        1057.   }
        1058.   
        1059. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
        1060.   
        1061.   void SSL_CTX_flush_sessions(SSL_CTX *s, long t)

crypto/lhash/lhash.c:273:1: Parameter `lh->num_nodes`
          271.   }
          272.   
          273. > void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg)
          274.   {
          275.       doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg);

crypto/lhash/lhash.c:275:5: Call
          273.   void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg)
          274.   {
          275.       doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg);
                     ^
          276.   }
          277.   

crypto/lhash/lhash.c:235:1: <LHS trace>
233.   }
234.   
235. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,
236.                             LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg)
237.   {

crypto/lhash/lhash.c:235:1: Parameter `lh->num_nodes`
            233.   }
            234.   
            235. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,
            236.                             LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg)
            237.   {

crypto/lhash/lhash.c:248:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_set_SSL_CTX` 
            246.        * memory leaks otherwise
            247.        */
            248.       for (i = lh->num_nodes - 1; i >= 0; i--) {
                            ^
            249.           a = lh->b[i];
            250.           while (a != NULL) {

static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,
                          LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg)
{
    int i;
    LHASH_NODE *a, *n;
    if (lh == NULL)
        return;
    for (i = lh->num_nodes - 1; i >= 0; i--) {
        a = lh->b[i];
        while (a != NULL) {
            n = a->next;
            if (use_arg)
                func_arg(a->data, arg);
            else
                func(a->data);
            a = n;
        }
    }
}
['static int ssl_servername_cb(SSL *s, int *ad, void *arg)\n{\n    tlsextctx *p = (tlsextctx *) arg;\n    const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);\n    if (servername && p->biodebug)\n        BIO_printf(p->biodebug, "Hostname in TLS extension: \\"%s\\"\\n",\n                   servername);\n    if (!p->servername)\n        return SSL_TLSEXT_ERR_NOACK;\n    if (servername) {\n        if (strcasecmp(servername, p->servername))\n            return p->extension_error;\n        if (ctx2) {\n            BIO_printf(p->biodebug, "Switching server context.\\n");\n            SSL_set_SSL_CTX(s, ctx2);\n        }\n    }\n    return SSL_TLSEXT_ERR_OK;\n}', 'SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx)\n{\n    CERT *new_cert;\n    if (ssl->ctx == ctx)\n        return ssl->ctx;\n    if (ctx == NULL)\n        ctx = ssl->initial_ctx;\n    new_cert = ssl_cert_dup(ctx->cert);\n    if (new_cert == NULL) {\n        return NULL;\n    }\n    ssl_cert_free(ssl->cert);\n    ssl->cert = new_cert;\n    OPENSSL_assert(ssl->sid_ctx_length <= sizeof(ssl->sid_ctx));\n    if ((ssl->ctx != NULL) &&\n        (ssl->sid_ctx_length == ssl->ctx->sid_ctx_length) &&\n        (memcmp(ssl->sid_ctx, ssl->ctx->sid_ctx, ssl->sid_ctx_length) == 0)) {\n        ssl->sid_ctx_length = ctx->sid_ctx_length;\n        memcpy(&ssl->sid_ctx, &ctx->sid_ctx, sizeof(ssl->sid_ctx));\n    }\n    SSL_CTX_up_ref(ctx);\n    SSL_CTX_free(ssl->ctx);\n    ssl->ctx = ctx;\n    return ssl->ctx;\n}', 'void SSL_CTX_free(SSL_CTX *a)\n{\n    int i;\n    if (a == NULL)\n        return;\n    CRYPTO_atomic_add(&a->references, -1, &i, a->lock);\n    REF_PRINT_COUNT("SSL_CTX", a);\n    if (i > 0)\n        return;\n    REF_ASSERT_ISNT(i < 0);\n    X509_VERIFY_PARAM_free(a->param);\n    dane_ctx_final(&a->dane);\n    if (a->sessions != NULL)\n        SSL_CTX_flush_sessions(a, 0);\n    CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data);\n    lh_SSL_SESSION_free(a->sessions);\n    X509_STORE_free(a->cert_store);\n#ifndef OPENSSL_NO_CT\n    CTLOG_STORE_free(a->ctlog_store);\n#endif\n    sk_SSL_CIPHER_free(a->cipher_list);\n    sk_SSL_CIPHER_free(a->cipher_list_by_id);\n    ssl_cert_free(a->cert);\n    sk_X509_NAME_pop_free(a->client_CA, X509_NAME_free);\n    sk_X509_pop_free(a->extra_certs, X509_free);\n    a->comp_methods = NULL;\n#ifndef OPENSSL_NO_SRTP\n    sk_SRTP_PROTECTION_PROFILE_free(a->srtp_profiles);\n#endif\n#ifndef OPENSSL_NO_SRP\n    SSL_CTX_SRP_CTX_free(a);\n#endif\n#ifndef OPENSSL_NO_ENGINE\n    ENGINE_finish(a->client_cert_engine);\n#endif\n#ifndef OPENSSL_NO_EC\n    OPENSSL_free(a->tlsext_ecpointformatlist);\n    OPENSSL_free(a->tlsext_ellipticcurvelist);\n#endif\n    OPENSSL_free(a->alpn_client_proto_list);\n    CRYPTO_THREAD_lock_free(a->lock);\n    OPENSSL_free(a);\n}', 'void SSL_CTX_flush_sessions(SSL_CTX *s, long t)\n{\n    unsigned long i;\n    TIMEOUT_PARAM tp;\n    tp.ctx = s;\n    tp.cache = s->sessions;\n    if (tp.cache == NULL)\n        return;\n    tp.time = t;\n    CRYPTO_THREAD_write_lock(s->lock);\n    i = CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load;\n    CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load = 0;\n    lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp);\n    CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load = i;\n    CRYPTO_THREAD_unlock(s->lock);\n}', 'IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM)', 'void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg)\n{\n    doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg);\n}', 'static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,\n                          LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg)\n{\n    int i;\n    LHASH_NODE *a, *n;\n    if (lh == NULL)\n        return;\n    for (i = lh->num_nodes - 1; i >= 0; i--) {\n        a = lh->b[i];\n        while (a != NULL) {\n            n = a->next;\n            if (use_arg)\n                func_arg(a->data, arg);\n            else\n                func(a->data);\n            a = n;\n        }\n    }\n}']