ssl/ssl_sess.c:263: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `SSL_CTX_remove_session`.
Showing all 9 steps of the trace


ssl/ssl_sess.c:189:1: Parameter `s->ctx->sessions->p`
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->p`
  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: Parameter `lh->pmax`
    229.   	}
    230.   
    231. > char *lh_delete(LHASH *lh, char *data)
    232.   	{
    233.   	unsigned long hash;

crypto/lhash/lhash.c:257:3: Call
    255.   	if ((lh->num_nodes > MIN_NODES) &&
    256.   		(lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
    257.   		contract(lh);
             ^
    258.   
    259.   	return(ret);

crypto/lhash/lhash.c:366:1: <LHS trace>
364.   	}
365.   
366. > static void contract(LHASH *lh)
367.   	{
368.   	LHASH_NODE **n,*n1,*np;

crypto/lhash/lhash.c:366:1: Parameter `lh->p`
      364.   	}
      365.   
      366. > static void contract(LHASH *lh)
      367.   	{
      368.   	LHASH_NODE **n,*n1,*np;

crypto/lhash/lhash.c:370:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_CTX_remove_session` 
      368.   	LHASH_NODE **n,*n1,*np;
      369.   
      370.   	np=lh->b[lh->p+lh->pmax-1];
                 ^
      371.   	lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */
      372.   	if (lh->p == 0)

static void contract(LHASH *lh)
	{
	LHASH_NODE **n,*n1,*np;
	np=lh->b[lh->p+lh->pmax-1];
	lh->b[lh->p+lh->pmax-1]=NULL;
	if (lh->p == 0)
		{
		n=(LHASH_NODE **)Realloc((char *)lh->b,
			(unsigned int)(sizeof(LHASH_NODE *)*lh->pmax));
		if (n == NULL)
			{
			lh->error++;
			return;
			}
		lh->num_contract_reallocs++;
		lh->num_alloc_nodes/=2;
		lh->pmax/=2;
		lh->p=lh->pmax-1;
		lh->b=n;
		}
	else
		lh->p--;
	lh->num_nodes--;
	lh->num_contracts++;
	n1=lh->b[(int)lh->p];
	if (n1 == NULL)
		lh->b[(int)lh->p]=np;
	else
		{
		while (n1->next != NULL)
			n1=n1->next;
		n1->next=np;
		}
	}
['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}', 'static void contract(LHASH *lh)\n\t{\n\tLHASH_NODE **n,*n1,*np;\n\tnp=lh->b[lh->p+lh->pmax-1];\n\tlh->b[lh->p+lh->pmax-1]=NULL;\n\tif (lh->p == 0)\n\t\t{\n\t\tn=(LHASH_NODE **)Realloc((char *)lh->b,\n\t\t\t(unsigned int)(sizeof(LHASH_NODE *)*lh->pmax));\n\t\tif (n == NULL)\n\t\t\t{\n\t\t\tlh->error++;\n\t\t\treturn;\n\t\t\t}\n\t\tlh->num_contract_reallocs++;\n\t\tlh->num_alloc_nodes/=2;\n\t\tlh->pmax/=2;\n\t\tlh->p=lh->pmax-1;\n\t\tlh->b=n;\n\t\t}\n\telse\n\t\tlh->p--;\n\tlh->num_nodes--;\n\tlh->num_contracts++;\n\tn1=lh->b[(int)lh->p];\n\tif (n1 == NULL)\n\t\tlh->b[(int)lh->p]=np;\n\telse\n\t\t{\n\t\twhile (n1->next != NULL)\n\t\t\tn1=n1->next;\n\t\tn1->next=np;\n\t\t}\n\t}']