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


ssl/ssl_sess.c:458:1: Parameter `s->initial_ctx->sessions->num_items`
456.    *     if the server should issue a new session ticket (to 0 otherwise).
457.    */
458. > int ssl_get_prev_session(SSL *s, unsigned char *session_id, int len,
459.   			const unsigned char *limit)
460.   	{

ssl/ssl_sess.c:596:4: Call
594.   			{
595.   			/* session was from the cache, so remove it */
596.   			SSL_CTX_remove_session(s->session_ctx,ret);
          ^
597.   			}
598.   		goto err;

ssl/ssl_sess.c:691:1: Parameter `ctx->sessions->num_items`
  689.   	}
  690.   
  691. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
  692.   {
  693.   	return remove_session_lock(ctx, c, 1);

ssl/ssl_sess.c:693:9: Call
  691.   int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
  692.   {
  693.   	return remove_session_lock(ctx, c, 1);
                 ^
  694.   }
  695.   

ssl/ssl_sess.c:696:1: Parameter `ctx->sessions->num_items`
    694.   }
    695.   
    696. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
    697.   	{
    698.   	SSL_SESSION *r;

ssl/ssl_sess.c:707:6: Call
    705.   			{
    706.   			ret=1;
    707.   			r=lh_SSL_SESSION_delete(ctx->sessions,c);
                ^
    708.   			SSL_SESSION_list_remove(ctx,c);
    709.   			}

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, 1+max(0, s->initial_ctx->sessions->num_items)] - 1):unsigned64 by call to `SSL_CTX_remove_session` 
      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;
	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_get_prev_session(SSL *s, unsigned char *session_id, int len,\n\t\t\tconst unsigned char *limit)\n\t{\n\tSSL_SESSION *ret=NULL;\n\tint fatal = 0;\n\tint try_session_cache = 1;\n#ifndef OPENSSL_NO_TLSEXT\n\tint r;\n#endif\n\tif (len > SSL_MAX_SSL_SESSION_ID_LENGTH)\n\t\tgoto err;\n\tif (len == 0)\n\t\ttry_session_cache = 0;\n#ifndef OPENSSL_NO_TLSEXT\n\tr = tls1_process_ticket(s, session_id, len, limit, &ret);\n\tswitch (r)\n\t\t{\n\tcase -1:\n\t\tfatal = 1;\n\t\tgoto err;\n\tcase 0:\n\tcase 1:\n\t\tbreak;\n\tcase 2:\n\tcase 3:\n\t\ttry_session_cache = 0;\n\t\tbreak;\n\tdefault:\n\t\tabort();\n\t\t}\n#endif\n\tif (try_session_cache &&\n\t    ret == NULL &&\n\t    !(s->session_ctx->session_cache_mode & SSL_SESS_CACHE_NO_INTERNAL_LOOKUP))\n\t\t{\n\t\tSSL_SESSION data;\n\t\tdata.ssl_version=s->version;\n\t\tdata.session_id_length=len;\n\t\tif (len == 0)\n\t\t\treturn 0;\n\t\tmemcpy(data.session_id,session_id,len);\n\t\tCRYPTO_r_lock(CRYPTO_LOCK_SSL_CTX);\n\t\tret=lh_SSL_SESSION_retrieve(s->session_ctx->sessions,&data);\n\t\tif (ret != NULL)\n\t\t\t{\n\t\t\tCRYPTO_add(&ret->references,1,CRYPTO_LOCK_SSL_SESSION);\n\t\t\t}\n\t\tCRYPTO_r_unlock(CRYPTO_LOCK_SSL_CTX);\n\t\tif (ret == NULL)\n\t\t\ts->session_ctx->stats.sess_miss++;\n\t\t}\n\tif (try_session_cache &&\n\t    ret == NULL &&\n\t    s->session_ctx->get_session_cb != NULL)\n\t\t{\n\t\tint copy=1;\n\t\tif ((ret=s->session_ctx->get_session_cb(s,session_id,len,&copy)))\n\t\t\t{\n\t\t\ts->session_ctx->stats.sess_cb_hit++;\n\t\t\tif (copy)\n\t\t\t\tCRYPTO_add(&ret->references,1,CRYPTO_LOCK_SSL_SESSION);\n\t\t\tif(!(s->session_ctx->session_cache_mode & SSL_SESS_CACHE_NO_INTERNAL_STORE))\n\t\t\t\tSSL_CTX_add_session(s->session_ctx,ret);\n\t\t\t}\n\t\t}\n\tif (ret == NULL)\n\t\tgoto err;\n\tif (ret->sid_ctx_length != s->sid_ctx_length\n\t    || memcmp(ret->sid_ctx,s->sid_ctx,ret->sid_ctx_length))\n\t\t{\n\t\tgoto err;\n\t\t}\n\tif((s->verify_mode & SSL_VERIFY_PEER) && s->sid_ctx_length == 0)\n\t\t{\n\t\tSSLerr(SSL_F_SSL_GET_PREV_SESSION,SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED);\n\t\tfatal = 1;\n\t\tgoto err;\n\t\t}\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\tgoto err;\n\t\t}\n\tif (ret->timeout < (long)(time(NULL) - ret->time))\n\t\t{\n\t\ts->session_ctx->stats.sess_timeout++;\n\t\tif (try_session_cache)\n\t\t\t{\n\t\t\tSSL_CTX_remove_session(s->session_ctx,ret);\n\t\t\t}\n\t\tgoto err;\n\t\t}\n\ts->session_ctx->stats.sess_hit++;\n\tif (s->session != NULL)\n\t\tSSL_SESSION_free(s->session);\n\ts->session=ret;\n\ts->verify_result = s->session->verify_result;\n\treturn 1;\n err:\n\tif (ret != NULL)\n\t\t{\n\t\tSSL_SESSION_free(ret);\n\t\tif (!try_session_cache)\n\t\t\t{\n\t\t\ts->tlsext_ticket_expected = 1;\n\t\t\t}\n\t\t}\n\tif (fatal)\n\t\treturn -1;\n\telse\n\t\treturn 0;\n\t}', 'int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)\n{\n\treturn remove_session_lock(ctx, c, 1);\n}', '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\tif ((r = lh_SSL_SESSION_retrieve(ctx->sessions,c)) == c)\n\t\t\t{\n\t\t\tret=1;\n\t\t\tr=lh_SSL_SESSION_delete(ctx->sessions,c);\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\tvoid *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(ret);\n\t}']