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


ssl/ssl_lib.c:2840:1: Parameter `s->initial_ctx->sessions->num_nodes`
2838.   }
2839.   
2840. > void ssl_update_cache(SSL *s, int mode)
2841.   {
2842.       int i;

ssl/ssl_lib.c:2866:13: Call
2864.                 ? s->session_ctx->stats.sess_connect_good
2865.                 : s->session_ctx->stats.sess_accept_good) & 0xff) == 0xff) {
2866.               SSL_CTX_flush_sessions(s->session_ctx, (unsigned long)time(NULL));
                    ^
2867.           }
2868.       }

ssl/ssl_sess.c:1074:1: Parameter `s->sessions->num_nodes`
  1072.   IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
  1073.   
  1074. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
  1075.   {
  1076.       unsigned long i;

ssl/ssl_sess.c:1087:5: Call
  1085.       i = CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load;
  1086.       CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load = 0;
  1087.       lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp);
              ^
  1088.       CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load = i;
  1089.       CRYPTO_THREAD_unlock(s->lock);

ssl/ssl_sess.c:1072:1: Parameter `lh->num_nodes`
    1070.   }
    1071.   
    1072. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
    1073.   
    1074.   void SSL_CTX_flush_sessions(SSL_CTX *s, long t)

ssl/ssl_sess.c:1072:1: Call
    1070.   }
    1071.   
    1072. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
    1073.   
    1074.   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, 1+max(0, s->initial_ctx->sessions->num_nodes)] - 1):unsigned32 by call to `SSL_CTX_flush_sessions` 
        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;
        }
    }
}
['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) && (!s->hit)\n        && ((i & SSL_SESS_CACHE_NO_INTERNAL_STORE)\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        if ((((mode & SSL_SESS_CACHE_CLIENT)\n              ? s->session_ctx->stats.sess_connect_good\n              : s->session_ctx->stats.sess_accept_good) & 0xff) == 0xff) {\n            SSL_CTX_flush_sessions(s->session_ctx, (unsigned long)time(NULL));\n        }\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 = 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}']