ssl/ssl_lib.c:3229: error: INTEGER_OVERFLOW_L2
  ([0, 1+max(0, `s->session_ctx->sessions->num_nodes`)] - 1):unsigned32 by call to `SSL_CTX_flush_sessions`.
Showing all 11 steps of the trace


ssl/ssl_lib.c:3198:1: Parameter `s->session_ctx->sessions->num_nodes`
3196.   }
3197.   
3198. > void ssl_update_cache(SSL *s, int mode)
3199.   {
3200.       int i;

ssl/ssl_lib.c:3229:13: Call
3227.           if (CRYPTO_atomic_read(stat, &val, s->session_ctx->lock)
3228.               && (val & 0xff) == 0xff)
3229.               SSL_CTX_flush_sessions(s->session_ctx, (unsigned long)time(NULL));
                    ^
3230.       }
3231.   }

ssl/ssl_sess.c:1094:1: Parameter `s->sessions->num_nodes`
  1092.   IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
  1093.   
  1094. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
  1095.   {
  1096.       unsigned long i;

ssl/ssl_sess.c:1107:5: Call
  1105.       i = lh_SSL_SESSION_get_down_load(s->sessions);
  1106.       lh_SSL_SESSION_set_down_load(s->sessions, 0);
  1107.       lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp);
              ^
  1108.       lh_SSL_SESSION_set_down_load(s->sessions, i);
  1109.       CRYPTO_THREAD_unlock(s->lock);

ssl/ssl_sess.c:1092:1: Parameter `lh->num_nodes`
    1090.   }
    1091.   
    1092. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
    1093.   
    1094.   void SSL_CTX_flush_sessions(SSL_CTX *s, long t)

ssl/ssl_sess.c:1092:1: Call
    1090.   }
    1091.   
    1092. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
    1093.   
    1094.   void SSL_CTX_flush_sessions(SSL_CTX *s, long t)

crypto/lhash/lhash.c:198:1: Parameter `lh->num_nodes`
      196.   }
      197.   
      198. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg)
      199.   {
      200.       doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg);

crypto/lhash/lhash.c:200:5: Call
      198.   void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg)
      199.   {
      200.       doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg);
                 ^
      201.   }
      202.   

crypto/lhash/lhash.c:166:1: <LHS trace>
164.   }
165.   
166. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
167.                             OPENSSL_LH_DOALL_FUNC func,
168.                             OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)

crypto/lhash/lhash.c:166:1: Parameter `lh->num_nodes`
        164.   }
        165.   
        166. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
        167.                             OPENSSL_LH_DOALL_FUNC func,
        168.                             OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)

crypto/lhash/lhash.c:180:10: Binary operation: ([0, 1+max(0, s->session_ctx->sessions->num_nodes)] - 1):unsigned32 by call to `SSL_CTX_flush_sessions` 
        178.        * memory leaks otherwise
        179.        */
        180.       for (i = lh->num_nodes - 1; i >= 0; i--) {
                        ^
        181.           a = lh->b[i];
        182.           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;
        }
    }
}
['void ssl_update_cache(SSL *s, int mode)\n{\n    int i;\n    if (s->session->session_id_length == 0)\n        return;\n    i = s->session_ctx->session_cache_mode;\n    if ((i & mode) != 0\n        && (!s->hit || SSL_IS_TLS13(s))\n        && ((i & SSL_SESS_CACHE_NO_INTERNAL_STORE) != 0\n            || SSL_CTX_add_session(s->session_ctx, s->session))\n        && s->session_ctx->new_session_cb != NULL) {\n        SSL_SESSION_up_ref(s->session);\n        if (!s->session_ctx->new_session_cb(s, s->session))\n            SSL_SESSION_free(s->session);\n    }\n    if ((!(i & SSL_SESS_CACHE_NO_AUTO_CLEAR)) && ((i & mode) == mode)) {\n        int *stat, val;\n        if (mode & SSL_SESS_CACHE_CLIENT)\n            stat = &s->session_ctx->stats.sess_connect_good;\n        else\n            stat = &s->session_ctx->stats.sess_accept_good;\n        if (CRYPTO_atomic_read(stat, &val, s->session_ctx->lock)\n            && (val & 0xff) == 0xff)\n            SSL_CTX_flush_sessions(s->session_ctx, (unsigned long)time(NULL));\n    }\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}']