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


ssl/ssl_sess.c:189:1: Parameter `s->ctx->sessions->num_items`
187.   	}
188.   
189. > int ssl_get_prev_session(SSL *s, unsigned char *session_id, int len)
190.   	{
191.   	SSL_SESSION *ret=NULL,data;

ssl/ssl_sess.c:263:3: Call
261.   		s->ctx->stats.sess_timeout++;
262.   		/* remove it from the cache */
263.   		SSL_CTX_remove_session(s->ctx,ret);
         ^
264.   		SSL_SESSION_free(ret);		/* again to actually Free it */
265.   		return(0);

ssl/ssl_sess.c:325:1: Parameter `ctx->sessions->num_items`
  323.   	}
  324.   
  325. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
  326.   	{
  327.   	SSL_SESSION *r;

ssl/ssl_sess.c:333:20: Call
  331.   		{
  332.   		CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);
  333.   		r=(SSL_SESSION *)lh_delete(ctx->sessions,(char *)c);
                            ^
  334.   		if (r != NULL)
  335.   			{

crypto/lhash/lhash.c:231:1: <LHS trace>
229.   	}
230.   
231. > char *lh_delete(LHASH *lh, char *data)
232.   	{
233.   	unsigned long hash;

crypto/lhash/lhash.c:231:1: Parameter `lh->num_items`
    229.   	}
    230.   
    231. > char *lh_delete(LHASH *lh, char *data)
    232.   	{
    233.   	unsigned long hash;

crypto/lhash/lhash.c:254:2: Binary operation: ([0, s->ctx->sessions->num_items + 1] - 1):unsigned64 by call to `SSL_CTX_remove_session` 
    252.   		}
    253.   
    254.   	lh->num_items--;
            ^
    255.   	if ((lh->num_nodes > MIN_NODES) &&
    256.   		(lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))

char *lh_delete(LHASH *lh, char *data)
	{
	unsigned long hash;
	LHASH_NODE *nn,**rn;
	char *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;
		Free((char *)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_get_prev_session(SSL *s, unsigned char *session_id, int len)\n\t{\n\tSSL_SESSION *ret=NULL,data;\n\tint copy=1;\n\tdata.ssl_version=s->version;\n\tdata.session_id_length=len;\n\tif (len > SSL_MAX_SSL_SESSION_ID_LENGTH)\n\t\treturn(0);\n\tmemcpy(data.session_id,session_id,len);\n\tif (!(s->ctx->session_cache_mode & SSL_SESS_CACHE_NO_INTERNAL_LOOKUP))\n\t\t{\n\t\tCRYPTO_r_lock(CRYPTO_LOCK_SSL_CTX);\n\t\tret=(SSL_SESSION *)lh_retrieve(s->ctx->sessions,(char *)&data);\n\t\tCRYPTO_r_unlock(CRYPTO_LOCK_SSL_CTX);\n\t\t}\n\tif (ret == NULL)\n\t\t{\n\t\ts->ctx->stats.sess_miss++;\n\t\tret=NULL;\n\t\tif (s->ctx->get_session_cb != NULL\n\t\t    && (ret=s->ctx->get_session_cb(s,session_id,len,&copy))\n\t\t       != NULL)\n\t\t\t{\n\t\t\ts->ctx->stats.sess_cb_hit++;\n\t\t\tSSL_CTX_add_session(s->ctx,ret);\n\t\t\t}\n\t\tif (ret == NULL) return(0);\n\t\t}\n\tif((s->verify_mode&SSL_VERIFY_PEER)\n\t   && (!s->sid_ctx_length || ret->sid_ctx_length != s->sid_ctx_length\n\t       || memcmp(ret->sid_ctx,s->sid_ctx,ret->sid_ctx_length)))\n\t    {\n\t    SSLerr(SSL_F_SSL_GET_PREV_SESSION,SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT);\n\t    return 0;\n\t    }\n\tif (!copy)\n\t    SSL_SESSION_free(ret);\n\tif (ret->cipher == NULL)\n\t\t{\n\t\tunsigned char buf[5],*p;\n\t\tunsigned long l;\n\t\tp=buf;\n\t\tl=ret->cipher_id;\n\t\tl2n(l,p);\n\t\tif ((ret->ssl_version>>8) == SSL3_VERSION_MAJOR)\n\t\t\tret->cipher=ssl_get_cipher_by_char(s,&(buf[2]));\n\t\telse\n\t\t\tret->cipher=ssl_get_cipher_by_char(s,&(buf[1]));\n\t\tif (ret->cipher == NULL)\n\t\t\treturn(0);\n\t\t}\n\tCRYPTO_add(&ret->references,1,CRYPTO_LOCK_SSL_SESSION);\n\tif ((long)(ret->time+ret->timeout) < (long)time(NULL))\n\t\t{\n\t\ts->ctx->stats.sess_timeout++;\n\t\tSSL_CTX_remove_session(s->ctx,ret);\n\t\tSSL_SESSION_free(ret);\n\t\treturn(0);\n\t\t}\n\ts->ctx->stats.sess_hit++;\n\tif (s->session != NULL)\n\t\tSSL_SESSION_free(s->session);\n\ts->session=ret;\n\treturn(1);\n\t}', 'int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)\n\t{\n\tSSL_SESSION *r;\n\tint ret=0;\n\tif ((c != NULL) && (c->session_id_length != 0))\n\t\t{\n\t\tCRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);\n\t\tr=(SSL_SESSION *)lh_delete(ctx->sessions,(char *)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\tCRYPTO_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}', 'char *lh_delete(LHASH *lh, char *data)\n\t{\n\tunsigned long hash;\n\tLHASH_NODE *nn,**rn;\n\tchar *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\tFree((char *)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(ret);\n\t}']