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


test/ssltest_old.c:300:13: Call
298.               !strcasecmp(servername, sn_server2)) {
299.               BIO_printf(bio_stdout, "Switching server context.\n");
300.               SSL_set_SSL_CTX(s, s_ctx2);
                   ^
301.           }
302.       }

ssl/ssl_lib.c:3473:1: Parameter `ssl->ctx->sessions->num_nodes`
  3471.   }
  3472.   
  3473. > SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx)
  3474.   {
  3475.       CERT *new_cert;

ssl/ssl_lib.c:3507:5: Call
  3505.   
  3506.       SSL_CTX_up_ref(ctx);
  3507.       SSL_CTX_free(ssl->ctx);     /* decrement reference count */
              ^
  3508.       ssl->ctx = ctx;
  3509.   

ssl/ssl_lib.c:2581:1: Parameter `a->sessions->num_nodes`
    2579.   }
    2580.   
    2581. > void SSL_CTX_free(SSL_CTX *a)
    2582.   {
    2583.       int i;

ssl/ssl_lib.c:2607:9: Call
    2605.        */
    2606.       if (a->sessions != NULL)
    2607.           SSL_CTX_flush_sessions(a, 0);
                    ^
    2608.   
    2609.       CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data);

ssl/ssl_sess.c:1008:1: Parameter `s->sessions->num_nodes`
      1006.   IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
      1007.   
      1008. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
      1009.   {
      1010.       unsigned long i;

ssl/ssl_sess.c:1021:5: Call
      1019.       i = lh_SSL_SESSION_get_down_load(s->sessions);
      1020.       lh_SSL_SESSION_set_down_load(s->sessions, 0);
      1021.       lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp);
                  ^
      1022.       lh_SSL_SESSION_set_down_load(s->sessions, i);
      1023.       CRYPTO_THREAD_unlock(s->lock);

ssl/ssl_sess.c:1006:1: Parameter `lh->num_nodes`
        1004.   }
        1005.   
        1006. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
        1007.   
        1008.   void SSL_CTX_flush_sessions(SSL_CTX *s, long t)

ssl/ssl_sess.c:1006:1: Call
        1004.   }
        1005.   
        1006. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
        1007.   
        1008.   void SSL_CTX_flush_sessions(SSL_CTX *s, long t)

crypto/lhash/lhash.c:182:1: Parameter `lh->num_nodes`
          180.   }
          181.   
          182. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg)
          183.   {
          184.       doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg);

crypto/lhash/lhash.c:184:5: Call
          182.   void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg)
          183.   {
          184.       doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg);
                     ^
          185.   }
          186.   

crypto/lhash/lhash.c:150:1: <LHS trace>
148.   }
149.   
150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
151.                             OPENSSL_LH_DOALL_FUNC func,
152.                             OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)

crypto/lhash/lhash.c:150:1: Parameter `lh->num_nodes`
            148.   }
            149.   
            150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
            151.                             OPENSSL_LH_DOALL_FUNC func,
            152.                             OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)

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

static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
                          OPENSSL_LH_DOALL_FUNC func,
                          OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)
{
    int i;
    OPENSSL_LH_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 servername_cb(SSL *s, int *ad, void *arg)\n{\n    const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);\n    if (sn_server2 == NULL) {\n        BIO_printf(bio_stdout, "Servername 2 is NULL\\n");\n        return SSL_TLSEXT_ERR_NOACK;\n    }\n    if (servername) {\n        if (s_ctx2 != NULL && sn_server2 != NULL &&\n            !strcasecmp(servername, sn_server2)) {\n            BIO_printf(bio_stdout, "Switching server context.\\n");\n            SSL_set_SSL_CTX(s, 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_supportedgroupslist);\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 = lh_SSL_SESSION_get_down_load(s->sessions);\n    lh_SSL_SESSION_set_down_load(s->sessions, 0);\n    lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp);\n    lh_SSL_SESSION_set_down_load(s->sessions, i);\n    CRYPTO_THREAD_unlock(s->lock);\n}', 'IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM)', 'void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg)\n{\n    doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg);\n}', 'static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,\n                          OPENSSL_LH_DOALL_FUNC func,\n                          OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)\n{\n    int i;\n    OPENSSL_LH_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}']