ssl/ssl_sess.c:779: 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:721:1: Parameter `ctx->sessions->num_items`
719.   }
720.   
721. > int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c)
722.   {
723.       int ret = 0;

ssl/ssl_sess.c:737:9: Call
735.   
736.       CRYPTO_THREAD_write_lock(ctx->lock);
737.       s = lh_SSL_SESSION_insert(ctx->sessions, c);
               ^
738.   
739.       /*

ssl/ssl_locl.h:684:1: Parameter `lh->num_items`
  682.   };
  683.   
  684. > DEFINE_LHASH_OF(SSL_SESSION);
  685.   /* Needed in ssl_cert.c */
  686.   DEFINE_LHASH_OF(X509_NAME);

ssl/ssl_locl.h:684:1: Call
  682.   };
  683.   
  684. > DEFINE_LHASH_OF(SSL_SESSION);
  685.   /* Needed in ssl_cert.c */
  686.   DEFINE_LHASH_OF(X509_NAME);

crypto/lhash/lhash.c:155:1: Parameter `lh->num_items`
    153.   }
    154.   
    155. > void *lh_insert(_LHASH *lh, void *data)
    156.   {
    157.       unsigned long hash;

ssl/ssl_sess.c:779:22: Call
777.               while (SSL_CTX_sess_number(ctx) >
778.                      SSL_CTX_sess_get_cache_size(ctx)) {
779.                   if (!remove_session_lock(ctx, ctx->session_cache_tail, 0))
                            ^
780.                       break;
781.                   else

ssl/ssl_sess.c:795:1: Parameter `ctx->sessions->num_items`
  793.   }
  794.   
  795. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
  796.   {
  797.       SSL_SESSION *r;

ssl/ssl_sess.c:805:17: Call
  803.           if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
  804.               ret = 1;
  805.               r = lh_SSL_SESSION_delete(ctx->sessions, c);
                         ^
  806.               SSL_SESSION_list_remove(ctx, c);
  807.           }

ssl/ssl_locl.h:684:1: Parameter `lh->num_items`
    682.   };
    683.   
    684. > DEFINE_LHASH_OF(SSL_SESSION);
    685.   /* Needed in ssl_cert.c */
    686.   DEFINE_LHASH_OF(X509_NAME);

ssl/ssl_locl.h:684:1: Call
    682.   };
    683.   
    684. > DEFINE_LHASH_OF(SSL_SESSION);
    685.   /* Needed in ssl_cert.c */
    686.   DEFINE_LHASH_OF(X509_NAME);

crypto/lhash/lhash.c:188:1: <LHS trace>
186.   }
187.   
188. > void *lh_delete(_LHASH *lh, const void *data)
189.   {
190.       unsigned long hash;

crypto/lhash/lhash.c:188:1: Parameter `lh->num_items`
      186.   }
      187.   
      188. > void *lh_delete(_LHASH *lh, const void *data)
      189.   {
      190.       unsigned long hash;

crypto/lhash/lhash.c:208:5: Binary operation: ([0, 1+max(0, ctx->sessions->num_items)] - 1):unsigned64 by call to `remove_session_lock` 
      206.       }
      207.   
      208.       lh->num_items--;
                 ^
      209.       if ((lh->num_nodes > MIN_NODES) &&
      210.           (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))

void *lh_delete(_LHASH *lh, const void *data)
{
    unsigned long hash;
    LHASH_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    }\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) >\n                   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 *lh_insert(_LHASH *lh, void *data)\n{\n    unsigned long hash;\n    LHASH_NODE *nn, **rn;\n    void *ret;\n    lh->error = 0;\n    if (lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))\n        expand(lh);\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        if (lck)\n            CRYPTO_THREAD_unlock(ctx->lock);\n        if (ret) {\n            r->not_resumable = 1;\n            if (ctx->remove_session_cb != NULL)\n                ctx->remove_session_cb(ctx, r);\n            SSL_SESSION_free(r);\n        }\n    } else\n        ret = 0;\n    return (ret);\n}', 'void *lh_delete(_LHASH *lh, const void *data)\n{\n    unsigned long hash;\n    LHASH_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}']