ssl/d1_pkt.c:565: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 13):unsigned32.
Showing all 3 steps of the trace


ssl/d1_pkt.c:575:4: <LHS trace>
573.   		if ( n != i)
574.   			{
575.   			s->packet_length = 0;
          ^
576.   			goto again;
577.   			}

ssl/d1_pkt.c:575:4: Assignment
573.   		if ( n != i)
574.   			{
575.   			s->packet_length = 0;
          ^
576.   			goto again;
577.   			}

ssl/d1_pkt.c:565:6: Binary operation: ([0, +oo] - 13):unsigned32
563.   	/* s->rstate == SSL_ST_READ_BODY, get and decode the data */
564.   
565.   	if (rr->length > s->packet_length-DTLS1_RT_HEADER_LENGTH)
            ^
566.   		{
567.   		/* now s->packet_length == DTLS1_RT_HEADER_LENGTH */

int dtls1_get_record(SSL *s)
	{
	int ssl_major,ssl_minor,al;
	int i,n;
	SSL3_RECORD *rr;
	SSL_SESSION *sess;
	unsigned char *p;
	short version;
	DTLS1_BITMAP *bitmap;
    unsigned int is_next_epoch;
	rr= &(s->s3->rrec);
	sess=s->session;
    if ( ! dtls1_process_buffered_records(s))
        return 0;
	if (dtls1_get_processed_record(s))
		return 1;
again:
	if (	(s->rstate != SSL_ST_READ_BODY) ||
		(s->packet_length < DTLS1_RT_HEADER_LENGTH))
		{
		n=ssl3_read_n(s, DTLS1_RT_HEADER_LENGTH, s->s3->rbuf.len, 0);
		if (n <= 0) return(n);
		OPENSSL_assert(s->packet_length == DTLS1_RT_HEADER_LENGTH);
		s->rstate=SSL_ST_READ_BODY;
		p=s->packet;
		rr->type= *(p++);
		ssl_major= *(p++);
		ssl_minor= *(p++);
		version=(ssl_major<<8)|ssl_minor;
		n2s(p,rr->epoch);
		memcpy(&(s->s3->read_sequence[2]), p, 6);
		p+=6;
		n2s(p,rr->length);
		if (s->first_packet)
			{
			s->first_packet=0;
			}
		else
			{
			if (version != s->version)
				{
				SSLerr(SSL_F_DTLS1_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER);
				s->version=version;
				al=SSL_AD_PROTOCOL_VERSION;
				goto f_err;
				}
			}
		if ((version & 0xff00) != (DTLS1_VERSION & 0xff00))
			{
			SSLerr(SSL_F_DTLS1_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER);
			goto err;
			}
		if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH)
			{
			al=SSL_AD_RECORD_OVERFLOW;
			SSLerr(SSL_F_DTLS1_GET_RECORD,SSL_R_PACKET_LENGTH_TOO_LONG);
			goto f_err;
			}
		}
	if (rr->length > s->packet_length-DTLS1_RT_HEADER_LENGTH)
		{
		i=rr->length;
		n=ssl3_read_n(s,i,i,1);
		if (n <= 0) return(n);
		if ( n != i)
			{
			s->packet_length = 0;
			goto again;
			}
		}
	s->rstate=SSL_ST_READ_HEADER;
	bitmap = dtls1_get_bitmap(s, rr, &is_next_epoch);
	if ( bitmap == NULL)
        {
        s->packet_length = 0;
        goto again;
		}
	if ( ! dtls1_record_replay_check(s, bitmap, &(rr->seq_num)))
		{
		s->packet_length=0;
		goto again;
		}
	if (rr->length == 0) goto again;
    if (is_next_epoch)
        {
        dtls1_record_bitmap_update(s, bitmap);
        dtls1_buffer_record(s, &(s->d1->unprocessed_rcds), rr->seq_num);
        s->packet_length = 0;
        goto again;
        }
    if ( ! dtls1_process_record(s))
        return(0);
	dtls1_clear_timeouts(s);
	return(1);
f_err:
	ssl3_send_alert(s,SSL3_AL_FATAL,al);
err:
	return(0);
	}
['int dtls1_get_record(SSL *s)\n\t{\n\tint ssl_major,ssl_minor,al;\n\tint i,n;\n\tSSL3_RECORD *rr;\n\tSSL_SESSION *sess;\n\tunsigned char *p;\n\tshort version;\n\tDTLS1_BITMAP *bitmap;\n    unsigned int is_next_epoch;\n\trr= &(s->s3->rrec);\n\tsess=s->session;\n    if ( ! dtls1_process_buffered_records(s))\n        return 0;\n\tif (dtls1_get_processed_record(s))\n\t\treturn 1;\nagain:\n\tif (\t(s->rstate != SSL_ST_READ_BODY) ||\n\t\t(s->packet_length < DTLS1_RT_HEADER_LENGTH))\n\t\t{\n\t\tn=ssl3_read_n(s, DTLS1_RT_HEADER_LENGTH, s->s3->rbuf.len, 0);\n\t\tif (n <= 0) return(n);\n\t\tOPENSSL_assert(s->packet_length == DTLS1_RT_HEADER_LENGTH);\n\t\ts->rstate=SSL_ST_READ_BODY;\n\t\tp=s->packet;\n\t\trr->type= *(p++);\n\t\tssl_major= *(p++);\n\t\tssl_minor= *(p++);\n\t\tversion=(ssl_major<<8)|ssl_minor;\n\t\tn2s(p,rr->epoch);\n\t\tmemcpy(&(s->s3->read_sequence[2]), p, 6);\n\t\tp+=6;\n\t\tn2s(p,rr->length);\n\t\tif (s->first_packet)\n\t\t\t{\n\t\t\ts->first_packet=0;\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tif (version != s->version)\n\t\t\t\t{\n\t\t\t\tSSLerr(SSL_F_DTLS1_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER);\n\t\t\t\ts->version=version;\n\t\t\t\tal=SSL_AD_PROTOCOL_VERSION;\n\t\t\t\tgoto f_err;\n\t\t\t\t}\n\t\t\t}\n\t\tif ((version & 0xff00) != (DTLS1_VERSION & 0xff00))\n\t\t\t{\n\t\t\tSSLerr(SSL_F_DTLS1_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER);\n\t\t\tgoto err;\n\t\t\t}\n\t\tif (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH)\n\t\t\t{\n\t\t\tal=SSL_AD_RECORD_OVERFLOW;\n\t\t\tSSLerr(SSL_F_DTLS1_GET_RECORD,SSL_R_PACKET_LENGTH_TOO_LONG);\n\t\t\tgoto f_err;\n\t\t\t}\n\t\t}\n\tif (rr->length > s->packet_length-DTLS1_RT_HEADER_LENGTH)\n\t\t{\n\t\ti=rr->length;\n\t\tn=ssl3_read_n(s,i,i,1);\n\t\tif (n <= 0) return(n);\n\t\tif ( n != i)\n\t\t\t{\n\t\t\ts->packet_length = 0;\n\t\t\tgoto again;\n\t\t\t}\n\t\t}\n\ts->rstate=SSL_ST_READ_HEADER;\n\tbitmap = dtls1_get_bitmap(s, rr, &is_next_epoch);\n\tif ( bitmap == NULL)\n        {\n        s->packet_length = 0;\n        goto again;\n\t\t}\n\tif ( ! dtls1_record_replay_check(s, bitmap, &(rr->seq_num)))\n\t\t{\n\t\ts->packet_length=0;\n\t\tgoto again;\n\t\t}\n\tif (rr->length == 0) goto again;\n    if (is_next_epoch)\n        {\n        dtls1_record_bitmap_update(s, bitmap);\n        dtls1_buffer_record(s, &(s->d1->unprocessed_rcds), rr->seq_num);\n        s->packet_length = 0;\n        goto again;\n        }\n    if ( ! dtls1_process_record(s))\n        return(0);\n\tdtls1_clear_timeouts(s);\n\treturn(1);\nf_err:\n\tssl3_send_alert(s,SSL3_AL_FATAL,al);\nerr:\n\treturn(0);\n\t}']