ssl/ssl_sess.c:714: error: INTEGER_OVERFLOW_L2
  ([0, 1+max(0, `ctx->sessions->num_items`)] - 1):unsigned64 by call to `remove_session_lock`.
Showing all 13 steps of the trace


ssl/ssl_sess.c:648:1: Parameter `ctx->sessions->num_items`
646.   }
647.   
648. > int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c)
649.   {
650.       int ret = 0;

ssl/ssl_sess.c:664:9: Call
662.   
663.       CRYPTO_THREAD_write_lock(ctx->lock);
664.       s = lh_SSL_SESSION_insert(ctx->sessions, c);
               ^
665.   
666.       /*

ssl/ssl_locl.h:660:1: Parameter `lh->num_items`
  658.   } CLIENTHELLO_MSG;
  659.   
  660. > DEFINE_LHASH_OF(SSL_SESSION);
  661.   /* Needed in ssl_cert.c */
  662.   DEFINE_LHASH_OF(X509_NAME);

ssl/ssl_locl.h:660:1: Call
  658.   } CLIENTHELLO_MSG;
  659.   
  660. > DEFINE_LHASH_OF(SSL_SESSION);
  661.   /* Needed in ssl_cert.c */
  662.   DEFINE_LHASH_OF(X509_NAME);

crypto/lhash/lhash.c:70:1: Parameter `lh->num_items`
    68.   }
    69.   
    70. > void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data)
    71.   {
    72.       unsigned long hash;

ssl/ssl_sess.c:714:22: Call
712.           if (SSL_CTX_sess_get_cache_size(ctx) > 0) {
713.               while (SSL_CTX_sess_number(ctx) > SSL_CTX_sess_get_cache_size(ctx)) {
714.                   if (!remove_session_lock(ctx, ctx->session_cache_tail, 0))
                            ^
715.                       break;
716.                   else

ssl/ssl_sess.c:730:1: Parameter `ctx->sessions->num_items`
  728.   }
  729.   
  730. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
  731.   {
  732.       SSL_SESSION *r;

ssl/ssl_sess.c:740:17: Call
  738.           if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
  739.               ret = 1;
  740.               r = lh_SSL_SESSION_delete(ctx->sessions, c);
                         ^
  741.               SSL_SESSION_list_remove(ctx, c);
  742.           }

ssl/ssl_locl.h:660:1: Parameter `lh->num_items`
    658.   } CLIENTHELLO_MSG;
    659.   
    660. > DEFINE_LHASH_OF(SSL_SESSION);
    661.   /* Needed in ssl_cert.c */
    662.   DEFINE_LHASH_OF(X509_NAME);

ssl/ssl_locl.h:660:1: Call
    658.   } CLIENTHELLO_MSG;
    659.   
    660. > DEFINE_LHASH_OF(SSL_SESSION);
    661.   /* Needed in ssl_cert.c */
    662.   DEFINE_LHASH_OF(X509_NAME);

crypto/lhash/lhash.c:103:1: <LHS trace>
101.   }
102.   
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104.   {
105.       unsigned long hash;

crypto/lhash/lhash.c:103:1: Parameter `lh->num_items`
      101.   }
      102.   
      103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
      104.   {
      105.       unsigned long hash;

crypto/lhash/lhash.c:123:5: Binary operation: ([0, 1+max(0, ctx->sessions->num_items)] - 1):unsigned64 by call to `remove_session_lock` 
      121.       }
      122.   
      123.       lh->num_items--;
                 ^
      124.       if ((lh->num_nodes > MIN_NODES) &&
      125.           (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);
}
['int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c)\n{\n    int ret = 0;\n    SSL_SESSION *s;\n    SSL_SESSION_up_ref(c);\n    CRYPTO_THREAD_write_lock(ctx->lock);\n    s = lh_SSL_SESSION_insert(ctx->sessions, c);\n    if (s != NULL && s != c) {\n        SSL_SESSION_list_remove(ctx, s);\n        SSL_SESSION_free(s);\n        s = NULL;\n    } else if (s == NULL &&\n               lh_SSL_SESSION_retrieve(ctx->sessions, c) == NULL) {\n        s = c;\n    }\n    if (s == NULL)\n        SSL_SESSION_list_add(ctx, c);\n    if (s != NULL) {\n        SSL_SESSION_free(s);\n        ret = 0;\n    } else {\n        ret = 1;\n        if (SSL_CTX_sess_get_cache_size(ctx) > 0) {\n            while (SSL_CTX_sess_number(ctx) > SSL_CTX_sess_get_cache_size(ctx)) {\n                if (!remove_session_lock(ctx, ctx->session_cache_tail, 0))\n                    break;\n                else\n                    ctx->stats.sess_cache_full++;\n            }\n        }\n    }\n    CRYPTO_THREAD_unlock(ctx->lock);\n    return ret;\n}', 'DEFINE_LHASH_OF(SSL_SESSION)', 'void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data)\n{\n    unsigned long hash;\n    OPENSSL_LH_NODE *nn, **rn;\n    void *ret;\n    lh->error = 0;\n    if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))\n        return NULL;\n    rn = getrn(lh, data, &hash);\n    if (*rn == NULL) {\n        if ((nn = OPENSSL_malloc(sizeof(*nn))) == NULL) {\n            lh->error++;\n            return (NULL);\n        }\n        nn->data = data;\n        nn->next = NULL;\n        nn->hash = hash;\n        *rn = nn;\n        ret = NULL;\n        lh->num_insert++;\n        lh->num_items++;\n    } else {\n        ret = (*rn)->data;\n        (*rn)->data = data;\n        lh->num_replace++;\n    }\n    return (ret);\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)) == c) {\n            ret = 1;\n            r = lh_SSL_SESSION_delete(ctx->sessions, c);\n            SSL_SESSION_list_remove(ctx, c);\n        }\n        c->not_resumable = 1;\n        if (lck)\n            CRYPTO_THREAD_unlock(ctx->lock);\n        if (ret)\n            SSL_SESSION_free(r);\n        if (ctx->remove_session_cb != NULL)\n            ctx->remove_session_cb(ctx, c);\n    } else\n        ret = 0;\n    return (ret);\n}', '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}']