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


ssl/ssl_sess.c:348:1: Parameter `ctx->sessions->num_items`
346.   	}
347.   
348. > int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c)
349.   	{
350.   	int ret=0;

ssl/ssl_sess.c:360:19: Call
358.   
359.   	CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);
360.   	s=(SSL_SESSION *)lh_insert(ctx->sessions,c);
                         ^
361.   	
362.   	/* s != NULL iff we already had a session with the given PID.

crypto/lhash/lhash.c:179:1: Parameter `lh->num_items`
  177.   	}
  178.   
  179. > void *lh_insert(LHASH *lh, const void *data)
  180.   	{
  181.   	unsigned long hash;

ssl/ssl_sess.c:401:10: Call
399.   				SSL_CTX_sess_get_cache_size(ctx))
400.   				{
401.   				if (!remove_session_lock(ctx,
                ^
402.   					ctx->session_cache_tail, 0))
403.   					break;

ssl/ssl_sess.c:418:1: Parameter `ctx->sessions->num_items`
  416.   }
  417.   
  418. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
  419.   	{
  420.   	SSL_SESSION *r;

ssl/ssl_sess.c:426:20: Call
  424.   		{
  425.   		if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);
  426.   		r=(SSL_SESSION *)lh_delete(ctx->sessions,c);
                            ^
  427.   		if (r != NULL)
  428.   			{

crypto/lhash/lhash.c:217:1: <LHS trace>
215.   	}
216.   
217. > void *lh_delete(LHASH *lh, const void *data)
218.   	{
219.   	unsigned long hash;

crypto/lhash/lhash.c:217:1: Parameter `lh->num_items`
    215.   	}
    216.   
    217. > void *lh_delete(LHASH *lh, const void *data)
    218.   	{
    219.   	unsigned long hash;

crypto/lhash/lhash.c:240:2: Binary operation: ([0, ctx->sessions->num_items + 1] - 1):unsigned64 by call to `remove_session_lock` 
    238.   		}
    239.   
    240.   	lh->num_items--;
            ^
    241.   	if ((lh->num_nodes > MIN_NODES) &&
    242.   		(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;
	const 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((void *)ret);
	}
['int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c)\n\t{\n\tint ret=0;\n\tSSL_SESSION *s;\n\tCRYPTO_add(&c->references,1,CRYPTO_LOCK_SSL_SESSION);\n\tCRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);\n\ts=(SSL_SESSION *)lh_insert(ctx->sessions,c);\n\tif (s != NULL && s != c)\n\t\t{\n\t\tSSL_SESSION_list_remove(ctx,s);\n\t\tSSL_SESSION_free(s);\n\t\ts = NULL;\n\t\t}\n\tif (s == NULL)\n\t\tSSL_SESSION_list_add(ctx,c);\n\tif (s != NULL)\n\t\t{\n\t\tSSL_SESSION_free(s);\n\t\tret=0;\n\t\t}\n\telse\n\t\t{\n\t\tret=1;\n\t\tif (SSL_CTX_sess_get_cache_size(ctx) > 0)\n\t\t\t{\n\t\t\twhile (SSL_CTX_sess_number(ctx) >\n\t\t\t\tSSL_CTX_sess_get_cache_size(ctx))\n\t\t\t\t{\n\t\t\t\tif (!remove_session_lock(ctx,\n\t\t\t\t\tctx->session_cache_tail, 0))\n\t\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t\tctx->stats.sess_cache_full++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tCRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX);\n\treturn(ret);\n\t}', 'void *lh_insert(LHASH *lh, const void *data)\n\t{\n\tunsigned long hash;\n\tLHASH_NODE *nn,**rn;\n\tconst void *ret;\n\tlh->error=0;\n\tif (lh->up_load <= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))\n\t\texpand(lh);\n\trn=getrn(lh,data,&hash);\n\tif (*rn == NULL)\n\t\t{\n\t\tif ((nn=(LHASH_NODE *)OPENSSL_malloc(sizeof(LHASH_NODE))) == NULL)\n\t\t\t{\n\t\t\tlh->error++;\n\t\t\treturn(NULL);\n\t\t\t}\n\t\tnn->data=data;\n\t\tnn->next=NULL;\n#ifndef NO_HASH_COMP\n\t\tnn->hash=hash;\n#endif\n\t\t*rn=nn;\n\t\tret=NULL;\n\t\tlh->num_insert++;\n\t\tlh->num_items++;\n\t\t}\n\telse\n\t\t{\n\t\tret= (*rn)->data;\n\t\t(*rn)->data=data;\n\t\tlh->num_replace++;\n\t\t}\n\treturn((void *)ret);\n\t}', 'static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)\n\t{\n\tSSL_SESSION *r;\n\tint ret=0;\n\tif ((c != NULL) && (c->session_id_length != 0))\n\t\t{\n\t\tif(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);\n\t\tr=(SSL_SESSION *)lh_delete(ctx->sessions,c);\n\t\tif (r != NULL)\n\t\t\t{\n\t\t\tret=1;\n\t\t\tSSL_SESSION_list_remove(ctx,c);\n\t\t\t}\n\t\tif(lck) CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX);\n\t\tif (ret)\n\t\t\t{\n\t\t\tr->not_resumable=1;\n\t\t\tif (ctx->remove_session_cb != NULL)\n\t\t\t\tctx->remove_session_cb(ctx,r);\n\t\t\tSSL_SESSION_free(r);\n\t\t\t}\n\t\t}\n\telse\n\t\tret=0;\n\treturn(ret);\n\t}', 'void *lh_delete(LHASH *lh, const void *data)\n\t{\n\tunsigned long hash;\n\tLHASH_NODE *nn,**rn;\n\tconst void *ret;\n\tlh->error=0;\n\trn=getrn(lh,data,&hash);\n\tif (*rn == NULL)\n\t\t{\n\t\tlh->num_no_delete++;\n\t\treturn(NULL);\n\t\t}\n\telse\n\t\t{\n\t\tnn= *rn;\n\t\t*rn=nn->next;\n\t\tret=nn->data;\n\t\tOPENSSL_free(nn);\n\t\tlh->num_delete++;\n\t\t}\n\tlh->num_items--;\n\tif ((lh->num_nodes > MIN_NODES) &&\n\t\t(lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))\n\t\tcontract(lh);\n\treturn((void *)ret);\n\t}']