ssl/d1_both.c:714: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `ssl3_send_alert`.
Showing all 14 steps of the trace


ssl/d1_both.c:620:18: Call
618.   
619.   	/* see if we have the required fragment already */
620.   	if ((frag_len = dtls1_retrieve_buffered_fragment(s,max,ok)) || *ok)
                        ^
621.   		{
622.   		if (*ok)	s->init_num += frag_len;

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

ssl/d1_both.c:714:2: Call
712.   
713.   f_err:
714.   	ssl3_send_alert(s,SSL3_AL_FATAL,al);
        ^
715.   	s->init_num = 0;
716.   

ssl/s3_pkt.c:1317:1: Parameter `s->ctx->sessions->p`
  1315.   	}
  1316.   
  1317. > void ssl3_send_alert(SSL *s, int level, int desc)
  1318.   	{
  1319.   	/* Map tls/ssl alert value to correct one */

ssl/s3_pkt.c:1326:3: Call
  1324.   	/* If a fatal one, remove from cache */
  1325.   	if ((level == 2) && (s->session != NULL))
  1326.   		SSL_CTX_remove_session(s->ctx,s->session);
            ^
  1327.   
  1328.   	s->s3->alert_dispatch=1;

ssl/ssl_sess.c:645:1: Parameter `ctx->sessions->p`
    643.   	}
    644.   
    645. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
    646.   {
    647.   	return remove_session_lock(ctx, c, 1);

ssl/ssl_sess.c:647:9: Call
    645.   int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
    646.   {
    647.   	return remove_session_lock(ctx, c, 1);
                   ^
    648.   }
    649.   

ssl/ssl_sess.c:650:1: Parameter `ctx->sessions->pmax`
      648.   }
      649.   
      650. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
      651.   	{
      652.   	SSL_SESSION *r;

ssl/ssl_sess.c:661:21: Call
      659.   			{
      660.   			ret=1;
      661.   			r=(SSL_SESSION *)lh_delete(ctx->sessions,c);
                                 ^
      662.   			SSL_SESSION_list_remove(ctx,c);
      663.   			}

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

crypto/lhash/lhash.c:243:3: Call
        241.   	if ((lh->num_nodes > MIN_NODES) &&
        242.   		(lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
        243.   		contract(lh);
                 ^
        244.   
        245.   	return(ret);

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

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

crypto/lhash/lhash.c:368:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ssl3_send_alert` 
          366.   	LHASH_NODE **n,*n1,*np;
          367.   
          368.   	np=lh->b[lh->p+lh->pmax-1];
                     ^
          369.   	lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */
          370.   	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 **)OPENSSL_realloc(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;
		}
	}
['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\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->msg_header.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}', 'void 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;\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\ts->method->ssl_dispatch_alert(s);\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 = (SSL_SESSION *)lh_retrieve(ctx->sessions,c)) == c)\n\t\t\t{\n\t\t\tret=1;\n\t\t\tr=(SSL_SESSION *)lh_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}', '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 **)OPENSSL_realloc(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}']