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


ssl/s3_clnt.c:567:4: Call
565.   	SSL_COMP *comp;
566.   
567.   	n=ssl3_get_message(s,
          ^
568.   		SSL3_ST_CR_SRVR_HELLO_A,
569.   		SSL3_ST_CR_SRVR_HELLO_B,

ssl/s3_both.c:263:1: Parameter `s->ctx->sessions->p`
  261.   	}
  262.   
  263. > long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok)
  264.   	{
  265.   	unsigned char *p;

ssl/s3_clnt.c:694:2: Call
692.   	return(1);
693.   f_err:
694.   	ssl3_send_alert(s,SSL3_AL_FATAL,al);
        ^
695.   err:
696.   	return(-1);

ssl/s3_pkt.c:1022:1: Parameter `s->ctx->sessions->p`
  1020.   	}
  1021.   
  1022. > void ssl3_send_alert(SSL *s, int level, int desc)
  1023.   	{
  1024.   	/* Map tls/ssl alert value to correct one */

ssl/s3_pkt.c:1029:3: Call
  1027.   	/* If a fatal one, remove from cache */
  1028.   	if ((level == 2) && (s->session != NULL))
  1029.   		SSL_CTX_remove_session(s->ctx,s->session);
            ^
  1030.   
  1031.   	s->s3->alert_dispatch=1;

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 `ssl3_send_alert` 
        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;
		}
	}
['static int ssl3_get_server_hello(SSL *s)\n\t{\n\tSTACK_OF(SSL_CIPHER) *sk;\n\tSSL_CIPHER *c;\n\tunsigned char *p,*d;\n\tint i,al,ok;\n\tunsigned int j;\n\tlong n;\n\tSSL_COMP *comp;\n\tn=ssl3_get_message(s,\n\t\tSSL3_ST_CR_SRVR_HELLO_A,\n\t\tSSL3_ST_CR_SRVR_HELLO_B,\n\t\tSSL3_MT_SERVER_HELLO,\n\t\t300,\n\t\t&ok);\n\tif (!ok) return((int)n);\n\td=p=(unsigned char *)s->init_buf->data;\n\tif ((p[0] != (s->version>>8)) || (p[1] != (s->version&0xff)))\n\t\t{\n\t\tSSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_WRONG_SSL_VERSION);\n\t\ts->version=(s->version&0xff00)|p[1];\n\t\tal=SSL_AD_PROTOCOL_VERSION;\n\t\tgoto f_err;\n\t\t}\n\tp+=2;\n\tmemcpy(s->s3->server_random,p,SSL3_RANDOM_SIZE);\n\tp+=SSL3_RANDOM_SIZE;\n\tj= *(p++);\n\tif ((j != 0) && (j != SSL3_SESSION_ID_SIZE))\n\t\t{\n\t\tif (j < SSL2_SSL_SESSION_ID_LENGTH)\n\t\t\t{\n\t\t\tal=SSL_AD_ILLEGAL_PARAMETER;\n\t\t\tSSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_SSL3_SESSION_ID_TOO_SHORT);\n\t\t\tgoto f_err;\n\t\t\t}\n\t\t}\n\tif (j != 0 && j == s->session->session_id_length\n\t    && memcmp(p,s->session->session_id,j) == 0)\n\t    {\n\t    if(s->sid_ctx_length != s->session->sid_ctx_length\n\t       || memcmp(s->session->sid_ctx,s->sid_ctx,s->sid_ctx_length))\n\t\t{\n\t\tal=SSL_AD_ILLEGAL_PARAMETER;\n\t\tSSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT);\n\t\tgoto f_err;\n\t\t}\n\t    s->hit=1;\n\t    }\n\telse\n\t\t{\n\t\ts->hit=0;\n\t\tif (s->session->session_id_length > 0)\n\t\t\t{\n\t\t\tif (!ssl_get_new_session(s,0))\n\t\t\t\t{\n\t\t\t\tal=SSL_AD_INTERNAL_ERROR;\n\t\t\t\tgoto f_err;\n\t\t\t\t}\n\t\t\t}\n\t\ts->session->session_id_length=j;\n\t\tmemcpy(s->session->session_id,p,j);\n\t\t}\n\tp+=j;\n\tc=ssl_get_cipher_by_char(s,p);\n\tif (c == NULL)\n\t\t{\n\t\tal=SSL_AD_ILLEGAL_PARAMETER;\n\t\tSSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_UNKNOWN_CIPHER_RETURNED);\n\t\tgoto f_err;\n\t\t}\n\tp+=ssl_put_cipher_by_char(s,NULL,NULL);\n\tsk=ssl_get_ciphers_by_id(s);\n\ti=sk_SSL_CIPHER_find(sk,c);\n\tif (i < 0)\n\t\t{\n\t\tal=SSL_AD_ILLEGAL_PARAMETER;\n\t\tSSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_WRONG_CIPHER_RETURNED);\n\t\tgoto f_err;\n\t\t}\n\tif (s->hit && (s->session->cipher != c))\n\t\t{\n\t\tif (!(s->options &\n\t\t\tSSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG))\n\t\t\t{\n\t\t\tal=SSL_AD_ILLEGAL_PARAMETER;\n\t\t\tSSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED);\n\t\t\tgoto f_err;\n\t\t\t}\n\t\t}\n\ts->s3->tmp.new_cipher=c;\n\tj= *(p++);\n\tif (j == 0)\n\t\tcomp=NULL;\n\telse\n\t\tcomp=ssl3_comp_find(s->ctx->comp_methods,j);\n\tif ((j != 0) && (comp == NULL))\n\t\t{\n\t\tal=SSL_AD_ILLEGAL_PARAMETER;\n\t\tSSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM);\n\t\tgoto f_err;\n\t\t}\n\telse\n\t\t{\n\t\ts->s3->tmp.new_compression=comp;\n\t\t}\n\tif (p != (d+n))\n\t\t{\n\t\tal=SSL_AD_DECODE_ERROR;\n\t\tSSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_BAD_PACKET_LENGTH);\n\t\tgoto err;\n\t\t}\n\treturn(1);\nf_err:\n\tssl3_send_alert(s,SSL3_AL_FATAL,al);\nerr:\n\treturn(-1);\n\t}', 'long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok)\n\t{\n\tunsigned char *p;\n\tunsigned long l;\n\tlong n;\n\tint i,al;\n\tif (s->s3->tmp.reuse_message)\n\t\t{\n\t\ts->s3->tmp.reuse_message=0;\n\t\tif ((mt >= 0) && (s->s3->tmp.message_type != mt))\n\t\t\t{\n\t\t\tal=SSL_AD_UNEXPECTED_MESSAGE;\n\t\t\tSSLerr(SSL_F_SSL3_GET_MESSAGE,SSL_R_UNEXPECTED_MESSAGE);\n\t\t\tgoto f_err;\n\t\t\t}\n\t\t*ok=1;\n\t\treturn((int)s->s3->tmp.message_size);\n\t\t}\n\tp=(unsigned char *)s->init_buf->data;\n\tif (s->state == st1)\n\t\t{\n\t\ti=ssl3_read_bytes(s,SSL3_RT_HANDSHAKE,\n\t\t\t(char *)&(p[s->init_num]),\n\t\t\t4-s->init_num);\n\t\tif (i < (4-s->init_num))\n\t\t\t{\n\t\t\t*ok=0;\n\t\t\treturn(ssl3_part_read(s,i));\n\t\t\t}\n\t\tif ((mt >= 0) && (*p != mt))\n\t\t\t{\n\t\t\tal=SSL_AD_UNEXPECTED_MESSAGE;\n\t\t\tSSLerr(SSL_F_SSL3_GET_MESSAGE,SSL_R_UNEXPECTED_MESSAGE);\n\t\t\tgoto f_err;\n\t\t\t}\n\t\ts->s3->tmp.message_type= *(p++);\n\t\tn2l3(p,l);\n\t\tif (l > (unsigned long)max)\n\t\t\t{\n\t\t\tal=SSL_AD_ILLEGAL_PARAMETER;\n\t\t\tSSLerr(SSL_F_SSL3_GET_MESSAGE,SSL_R_EXCESSIVE_MESSAGE_SIZE);\n\t\t\tgoto f_err;\n\t\t\t}\n\t\tif (l && !BUF_MEM_grow(s->init_buf,(int)l))\n\t\t\t{\n\t\t\tSSLerr(SSL_F_SSL3_GET_MESSAGE,ERR_R_BUF_LIB);\n\t\t\tgoto err;\n\t\t\t}\n\t\ts->s3->tmp.message_size=l;\n\t\ts->state=stn;\n\t\ts->init_num=0;\n\t\t}\n\tp=(unsigned char *)s->init_buf->data;\n\tn=s->s3->tmp.message_size;\n\tif (n > 0)\n\t\t{\n\t\ti=ssl3_read_bytes(s,SSL3_RT_HANDSHAKE,\n\t\t\t(char *)&(p[s->init_num]),(int)n);\n\t\tif (i != (int)n)\n\t\t\t{\n\t\t\t*ok=0;\n\t\t\treturn(ssl3_part_read(s,i));\n\t\t\t}\n\t\t}\n\t*ok=1;\n\treturn(n);\nf_err:\n\tssl3_send_alert(s,SSL3_AL_FATAL,al);\nerr:\n\t*ok=0;\n\treturn(-1);\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 (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\tssl3_dispatch_alert(s);\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}']