ssl/d1_both.c:730: error: INTEGER_OVERFLOW_L2
  ([0, max(0, `s->ctx->sessions->num_items`)] - 1):unsigned64 by call to `ssl3_send_alert`.
Showing all 13 steps of the trace


ssl/d1_both.c:627:1: Parameter `s->ctx->sessions->num_items`
625.   
626.   
627. > static long
628.   dtls1_get_message_fragment(SSL *s, int st1, int stn, long max, int *ok)
629.   	{

ssl/d1_both.c:636:18: Call
634.   
635.   	/* see if we have the required fragment already */
636.   	if ((frag_len = dtls1_retrieve_buffered_fragment(s,max,ok)) || *ok)
                        ^
637.   		{
638.   		if (*ok)	s->init_num += frag_len;

ssl/d1_both.c:501:1: Parameter `s->ctx->sessions->num_items`
  499.   
  500.   
  501. > static int
  502.   dtls1_retrieve_buffered_fragment(SSL *s, long max, int *ok)
  503.   	{

ssl/d1_both.c:730:2: Call
728.   
729.   f_err:
730.   	ssl3_send_alert(s,SSL3_AL_FATAL,al);
        ^
731.   	s->init_num = 0;
732.   

ssl/s3_pkt.c:1353:1: Parameter `s->ctx->sessions->num_items`
  1351.   	}
  1352.   
  1353. > int ssl3_send_alert(SSL *s, int level, int desc)
  1354.   	{
  1355.   	/* Map tls/ssl alert value to correct one */

ssl/s3_pkt.c:1362:3: Call
  1360.   	/* If a fatal one, remove from cache */
  1361.   	if ((level == 2) && (s->session != NULL))
  1362.   		SSL_CTX_remove_session(s->ctx,s->session);
            ^
  1363.   
  1364.   	s->s3->alert_dispatch=1;

ssl/ssl_sess.c:653:1: Parameter `ctx->sessions->num_items`
    651.   	}
    652.   
    653. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
    654.   {
    655.   	return remove_session_lock(ctx, c, 1);

ssl/ssl_sess.c:655:9: Call
    653.   int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
    654.   {
    655.   	return remove_session_lock(ctx, c, 1);
                   ^
    656.   }
    657.   

ssl/ssl_sess.c:658:1: Parameter `ctx->sessions->num_items`
      656.   }
      657.   
      658. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
      659.   	{
      660.   	SSL_SESSION *r;

ssl/ssl_sess.c:669:6: Call
      667.   			{
      668.   			ret=1;
      669.   			r=lh_SSL_SESSION_delete(ctx->sessions,c);
                  ^
      670.   			SSL_SESSION_list_remove(ctx,c);
      671.   			}

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, max(0, s->ctx->sessions->num_items)] - 1):unsigned64 by call to `ssl3_send_alert` 
        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);
	}
['static long\ndtls1_get_message_fragment(SSL *s, int st1, int stn, long max, int *ok)\n\t{\n\tunsigned char wire[DTLS1_HM_HEADER_LENGTH];\n\tunsigned long l, frag_off, frag_len;\n\tint i,al;\n\tstruct hm_header_st msg_hdr;\n\tif ((frag_len = dtls1_retrieve_buffered_fragment(s,max,ok)) || *ok)\n\t\t{\n\t\tif (*ok)\ts->init_num += frag_len;\n\t\treturn frag_len;\n\t\t}\n\ti=s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE,wire,\n\t\tDTLS1_HM_HEADER_LENGTH, 0);\n\tif (i <= 0)\n\t\t{\n\t\ts->rwstate=SSL_READING;\n\t\t*ok = 0;\n\t\treturn i;\n\t\t}\n\tOPENSSL_assert(i == DTLS1_HM_HEADER_LENGTH);\n\tdtls1_get_message_header(wire, &msg_hdr);\n\tif ( msg_hdr.seq != s->d1->handshake_read_seq)\n\t\treturn dtls1_process_out_of_seq_message(s, &msg_hdr, ok);\n\tl = msg_hdr.msg_len;\n\tfrag_off = msg_hdr.frag_off;\n\tfrag_len = msg_hdr.frag_len;\n\tif (!s->server && s->d1->r_msg_hdr.frag_off == 0 &&\n\t\twire[0] == SSL3_MT_HELLO_REQUEST)\n\t\t{\n\t\tif (wire[1] == 0 && wire[2] == 0 && wire[3] == 0)\n\t\t\t{\n\t\t\tif (s->msg_callback)\n\t\t\t\ts->msg_callback(0, s->version, SSL3_RT_HANDSHAKE,\n\t\t\t\t\twire, DTLS1_HM_HEADER_LENGTH, s,\n\t\t\t\t\ts->msg_callback_arg);\n\t\t\ts->init_num = 0;\n\t\t\treturn dtls1_get_message_fragment(s, st1, stn,\n\t\t\t\tmax, ok);\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tal=SSL_AD_UNEXPECTED_MESSAGE;\n\t\t\tSSLerr(SSL_F_DTLS1_GET_MESSAGE_FRAGMENT,SSL_R_UNEXPECTED_MESSAGE);\n\t\t\tgoto f_err;\n\t\t\t}\n\t\t}\n\tif ((al=dtls1_preprocess_fragment(s,&msg_hdr,max)))\n\t\tgoto f_err;\n\ts->state=stn;\n\tif ( frag_len > 0)\n\t\t{\n\t\tunsigned char *p=(unsigned char *)s->init_buf->data+DTLS1_HM_HEADER_LENGTH;\n\t\ti=s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE,\n\t\t\t&p[frag_off],frag_len,0);\n\t\tif (i <= 0)\n\t\t\t{\n\t\t\ts->rwstate=SSL_READING;\n\t\t\t*ok = 0;\n\t\t\treturn i;\n\t\t\t}\n\t\t}\n\telse\n\t\ti = 0;\n\tOPENSSL_assert(i == (int)frag_len);\n\t*ok = 1;\n\ts->init_num += frag_len;\n\treturn frag_len;\nf_err:\n\tssl3_send_alert(s,SSL3_AL_FATAL,al);\n\ts->init_num = 0;\n\t*ok=0;\n\treturn(-1);\n\t}', 'static int\ndtls1_retrieve_buffered_fragment(SSL *s, long max, int *ok)\n\t{\n\tpitem *item;\n\thm_fragment *frag;\n\tint al;\n\t*ok = 0;\n\titem = pqueue_peek(s->d1->buffered_messages);\n\tif ( item == NULL)\n\t\treturn 0;\n\tfrag = (hm_fragment *)item->data;\n\tif ( s->d1->handshake_read_seq == frag->msg_header.seq)\n\t\t{\n\t\tunsigned long frag_len = frag->msg_header.frag_len;\n\t\tpqueue_pop(s->d1->buffered_messages);\n\t\tal=dtls1_preprocess_fragment(s,&frag->msg_header,max);\n\t\tif (al==0)\n\t\t\t{\n\t\t\tunsigned char *p = (unsigned char *)s->init_buf->data+DTLS1_HM_HEADER_LENGTH;\n\t\t\tmemcpy(&p[frag->msg_header.frag_off],\n\t\t\t\tfrag->fragment,frag->msg_header.frag_len);\n\t\t\t}\n\t\tdtls1_hm_fragment_free(frag);\n\t\tpitem_free(item);\n\t\tif (al==0)\n\t\t\t{\n\t\t\t*ok = 1;\n\t\t\treturn frag_len;\n\t\t\t}\n\t\tssl3_send_alert(s,SSL3_AL_FATAL,al);\n\t\ts->init_num = 0;\n\t\t*ok = 0;\n\t\treturn -1;\n\t\t}\n\telse\n\t\treturn 0;\n\t}', 'int ssl3_send_alert(SSL *s, int level, int desc)\n\t{\n\tdesc=s->method->ssl3_enc->alert_value(desc);\n\tif (s->version == SSL3_VERSION && desc == SSL_AD_PROTOCOL_VERSION)\n\t\tdesc = SSL_AD_HANDSHAKE_FAILURE;\n\tif (desc < 0) return -1;\n\tif ((level == 2) && (s->session != NULL))\n\t\tSSL_CTX_remove_session(s->ctx,s->session);\n\ts->s3->alert_dispatch=1;\n\ts->s3->send_alert[0]=level;\n\ts->s3->send_alert[1]=desc;\n\tif (s->s3->wbuf.left == 0)\n\t\treturn s->method->ssl_dispatch_alert(s);\n\treturn -1;\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}']