ssl/d1_lib.c:625: error: INTEGER_OVERFLOW_L2
  ([2, +oo] - 32):unsigned64 by call to `PACKET_forward`.
Showing all 26 steps of the trace


ssl/d1_lib.c:576:17: Call
574.               || !PACKET_get_net_3(&msgpkt, &fragoff)
575.               || !PACKET_get_net_3(&msgpkt, &fraglen)
576.               || !PACKET_get_sub_packet(&msgpkt, &msgpayload, fraglen)
                       ^
577.               || PACKET_remaining(&msgpkt) != 0) {
578.               SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH);

ssl/packet_locl.h:124:8: Parameter `subpkt->remaining`
  122.    * original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|.
  123.    */
  124.   __owur static ossl_inline int PACKET_get_sub_packet(PACKET *pkt,
                ^
  125.                                                       PACKET *subpkt, size_t len)
  126.   {

ssl/packet_locl.h:127:10: Call
  125.                                                       PACKET *subpkt, size_t len)
  126.   {
  127.       if (!PACKET_peek_sub_packet(pkt, subpkt, len))
                  ^
  128.           return 0;
  129.   

ssl/packet_locl.h:110:8: Parameter `subpkt->remaining`
    108.    * the original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|.
    109.    */
    110.   __owur static ossl_inline int PACKET_peek_sub_packet(const PACKET *pkt,
                  ^
    111.                                                        PACKET *subpkt, size_t len)
    112.   {

ssl/d1_lib.c:611:14: Call
609.                               s->msg_callback_arg);
610.   
611.           if (!PACKET_get_net_2(&msgpayload, &clientvers)) {
                    ^
612.               SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH);
613.               goto end;

ssl/packet_locl.h:153:8: Parameter `pkt->remaining`
  151.   /* Equivalent of n2s */
  152.   /* Get 2 bytes in network order from |pkt| and store the value in |*data| */
  153.   __owur static ossl_inline int PACKET_get_net_2(PACKET *pkt, unsigned int *data)
                ^
  154.   {
  155.       if (!PACKET_peek_net_2(pkt, data))

ssl/packet_locl.h:155:10: Call
  153.   __owur static ossl_inline int PACKET_get_net_2(PACKET *pkt, unsigned int *data)
  154.   {
  155.       if (!PACKET_peek_net_2(pkt, data))
                  ^
  156.           return 0;
  157.   

ssl/packet_locl.h:139:8: Parameter `pkt->remaining`
    137.    * |*data|
    138.    */
    139.   __owur static ossl_inline int PACKET_peek_net_2(const PACKET *pkt,
                  ^
    140.                                                   unsigned int *data)
    141.   {

ssl/d1_lib.c:625:14: Call
623.           }
624.   
625.           if (!PACKET_forward(&msgpayload, SSL3_RANDOM_SIZE)
                    ^
626.               || !PACKET_get_length_prefixed_1(&msgpayload, &session)
627.               || !PACKET_get_length_prefixed_1(&msgpayload, &cookiepkt)) {

ssl/packet_locl.h:419:8: Parameter `len`
  417.   
  418.   /* Move the current reading position forward |len| bytes */
  419.   __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len)
                ^
  420.   {
  421.       if (PACKET_remaining(pkt) < len)

ssl/d1_lib.c:576:17: Call
574.               || !PACKET_get_net_3(&msgpkt, &fragoff)
575.               || !PACKET_get_net_3(&msgpkt, &fraglen)
576.               || !PACKET_get_sub_packet(&msgpkt, &msgpayload, fraglen)
                       ^
577.               || PACKET_remaining(&msgpkt) != 0) {
578.               SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH);

ssl/packet_locl.h:124:8: Parameter `subpkt->remaining`
  122.    * original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|.
  123.    */
  124.   __owur static ossl_inline int PACKET_get_sub_packet(PACKET *pkt,
                ^
  125.                                                       PACKET *subpkt, size_t len)
  126.   {

ssl/packet_locl.h:127:10: Call
  125.                                                       PACKET *subpkt, size_t len)
  126.   {
  127.       if (!PACKET_peek_sub_packet(pkt, subpkt, len))
                  ^
  128.           return 0;
  129.   

ssl/packet_locl.h:110:8: Parameter `subpkt->remaining`
    108.    * the original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|.
    109.    */
    110.   __owur static ossl_inline int PACKET_peek_sub_packet(const PACKET *pkt,
                  ^
    111.                                                        PACKET *subpkt, size_t len)
    112.   {

ssl/d1_lib.c:611:14: Call
609.                               s->msg_callback_arg);
610.   
611.           if (!PACKET_get_net_2(&msgpayload, &clientvers)) {
                    ^
612.               SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH);
613.               goto end;

ssl/packet_locl.h:153:8: Parameter `pkt->remaining`
  151.   /* Equivalent of n2s */
  152.   /* Get 2 bytes in network order from |pkt| and store the value in |*data| */
  153.   __owur static ossl_inline int PACKET_get_net_2(PACKET *pkt, unsigned int *data)
                ^
  154.   {
  155.       if (!PACKET_peek_net_2(pkt, data))

ssl/packet_locl.h:155:10: Call
  153.   __owur static ossl_inline int PACKET_get_net_2(PACKET *pkt, unsigned int *data)
  154.   {
  155.       if (!PACKET_peek_net_2(pkt, data))
                  ^
  156.           return 0;
  157.   

ssl/packet_locl.h:139:8: Parameter `pkt->remaining`
    137.    * |*data|
    138.    */
    139.   __owur static ossl_inline int PACKET_peek_net_2(const PACKET *pkt,
                  ^
    140.                                                   unsigned int *data)
    141.   {

ssl/d1_lib.c:625:14: Call
623.           }
624.   
625.           if (!PACKET_forward(&msgpayload, SSL3_RANDOM_SIZE)
                    ^
626.               || !PACKET_get_length_prefixed_1(&msgpayload, &session)
627.               || !PACKET_get_length_prefixed_1(&msgpayload, &cookiepkt)) {

ssl/packet_locl.h:419:8: Parameter `len`
  417.   
  418.   /* Move the current reading position forward |len| bytes */
  419.   __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len)
                ^
  420.   {
  421.       if (PACKET_remaining(pkt) < len)

ssl/packet_locl.h:424:5: Call
  422.           return 0;
  423.   
  424.       packet_forward(pkt, len);
             ^
  425.   
  426.       return 1;

ssl/packet_locl.h:33:1: <LHS trace>
31.   
32.   /* Internal unchecked shorthand; don't use outside this file. */
33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
34.   {
35.       pkt->curr += len;

ssl/packet_locl.h:33:1: Parameter `pkt->remaining`
    31.   
    32.   /* Internal unchecked shorthand; don't use outside this file. */
    33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
    34.   {
    35.       pkt->curr += len;

ssl/packet_locl.h:33:1: <RHS trace>
31.   
32.   /* Internal unchecked shorthand; don't use outside this file. */
33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
34.   {
35.       pkt->curr += len;

ssl/packet_locl.h:33:1: Parameter `len`
    31.   
    32.   /* Internal unchecked shorthand; don't use outside this file. */
    33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
    34.   {
    35.       pkt->curr += len;

ssl/packet_locl.h:36:5: Binary operation: ([2, +oo] - 32):unsigned64 by call to `PACKET_forward` 
    34.   {
    35.       pkt->curr += len;
    36.       pkt->remaining -= len;
              ^
    37.   }
    38.   

static ossl_inline void packet_forward(PACKET *pkt, size_t len)
{
    pkt->curr += len;
    pkt->remaining -= len;
}
['int DTLSv1_listen(SSL *s, BIO_ADDR *client)\n{\n    int next, n, ret = 0, clearpkt = 0;\n    unsigned char cookie[DTLS1_COOKIE_LENGTH];\n    unsigned char seq[SEQ_NUM_SIZE];\n    const unsigned char *data;\n    unsigned char *p, *buf;\n    unsigned long reclen, fragoff, fraglen, msglen;\n    unsigned int rectype, versmajor, msgseq, msgtype, clientvers, cookielen;\n    BIO *rbio, *wbio;\n    BUF_MEM *bufm;\n    BIO_ADDR *tmpclient = NULL;\n    PACKET pkt, msgpkt, msgpayload, session, cookiepkt;\n    if (!SSL_clear(s))\n        return -1;\n    ERR_clear_error();\n    rbio = SSL_get_rbio(s);\n    wbio = SSL_get_wbio(s);\n    if (!rbio || !wbio) {\n        SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_BIO_NOT_SET);\n        return -1;\n    }\n    BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_PEEK_MODE, 1, NULL);\n    if ((s->version & 0xff00) != (DTLS1_VERSION & 0xff00)) {\n        SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_UNSUPPORTED_SSL_VERSION);\n        return -1;\n    }\n    if (s->init_buf == NULL) {\n        if ((bufm = BUF_MEM_new()) == NULL) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, ERR_R_MALLOC_FAILURE);\n            return -1;\n        }\n        if (!BUF_MEM_grow(bufm, SSL3_RT_MAX_PLAIN_LENGTH)) {\n            BUF_MEM_free(bufm);\n            SSLerr(SSL_F_DTLSV1_LISTEN, ERR_R_MALLOC_FAILURE);\n            return -1;\n        }\n        s->init_buf = bufm;\n    }\n    buf = (unsigned char *)s->init_buf->data;\n    do {\n        clear_sys_error();\n        n = BIO_read(rbio, buf, SSL3_RT_MAX_PLAIN_LENGTH);\n        if (n <= 0) {\n            if (BIO_should_retry(rbio)) {\n                goto end;\n            }\n            return -1;\n        }\n        clearpkt = 1;\n        if (!PACKET_buf_init(&pkt, buf, n)) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, ERR_R_INTERNAL_ERROR);\n            return -1;\n        }\n        if (n < DTLS1_RT_HEADER_LENGTH) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_RECORD_TOO_SMALL);\n            goto end;\n        }\n        if (s->msg_callback)\n            s->msg_callback(0, 0, SSL3_RT_HEADER, buf,\n                            DTLS1_RT_HEADER_LENGTH, s, s->msg_callback_arg);\n        if (!PACKET_get_1(&pkt, &rectype)\n            || !PACKET_get_1(&pkt, &versmajor)) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH);\n            goto end;\n        }\n        if (rectype != SSL3_RT_HANDSHAKE) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_UNEXPECTED_MESSAGE);\n            goto end;\n        }\n        if (versmajor != DTLS1_VERSION_MAJOR) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_BAD_PROTOCOL_VERSION_NUMBER);\n            goto end;\n        }\n        if (!PACKET_forward(&pkt, 1)\n            || !PACKET_copy_bytes(&pkt, seq, SEQ_NUM_SIZE)\n            || !PACKET_get_length_prefixed_2(&pkt, &msgpkt)) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH);\n            goto end;\n        }\n        if (seq[0] != 0 || seq[1] != 0) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_UNEXPECTED_MESSAGE);\n            goto end;\n        }\n        data = PACKET_data(&msgpkt);\n        if (!PACKET_get_1(&msgpkt, &msgtype)\n            || !PACKET_get_net_3(&msgpkt, &msglen)\n            || !PACKET_get_net_2(&msgpkt, &msgseq)\n            || !PACKET_get_net_3(&msgpkt, &fragoff)\n            || !PACKET_get_net_3(&msgpkt, &fraglen)\n            || !PACKET_get_sub_packet(&msgpkt, &msgpayload, fraglen)\n            || PACKET_remaining(&msgpkt) != 0) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH);\n            goto end;\n        }\n        if (msgtype != SSL3_MT_CLIENT_HELLO) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_UNEXPECTED_MESSAGE);\n            goto end;\n        }\n        if (msgseq > 2) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_INVALID_SEQUENCE_NUMBER);\n            goto end;\n        }\n        if (fragoff != 0 || fraglen > msglen) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_FRAGMENTED_CLIENT_HELLO);\n            goto end;\n        }\n        if (s->msg_callback)\n            s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, data,\n                            fraglen + DTLS1_HM_HEADER_LENGTH, s,\n                            s->msg_callback_arg);\n        if (!PACKET_get_net_2(&msgpayload, &clientvers)) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH);\n            goto end;\n        }\n        if (DTLS_VERSION_LT(clientvers, (unsigned int)s->method->version) &&\n            s->method->version != DTLS_ANY_VERSION) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_WRONG_VERSION_NUMBER);\n            goto end;\n        }\n        if (!PACKET_forward(&msgpayload, SSL3_RANDOM_SIZE)\n            || !PACKET_get_length_prefixed_1(&msgpayload, &session)\n            || !PACKET_get_length_prefixed_1(&msgpayload, &cookiepkt)) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH);\n            goto end;\n        }\n        if (PACKET_remaining(&cookiepkt) == 0) {\n            next = LISTEN_SEND_VERIFY_REQUEST;\n        } else {\n            if (s->ctx->app_verify_cookie_cb == NULL) {\n                SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_NO_VERIFY_COOKIE_CALLBACK);\n                return -1;\n            }\n            if (s->ctx->app_verify_cookie_cb(s, PACKET_data(&cookiepkt),\n                                             PACKET_remaining(&cookiepkt)) ==\n                0) {\n                next = LISTEN_SEND_VERIFY_REQUEST;\n            } else {\n                next = LISTEN_SUCCESS;\n            }\n        }\n        if (next == LISTEN_SEND_VERIFY_REQUEST) {\n            BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_PEEK_MODE, 0, NULL);\n            BIO_read(rbio, buf, SSL3_RT_MAX_PLAIN_LENGTH);\n            BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_PEEK_MODE, 1, NULL);\n            if (s->ctx->app_gen_cookie_cb == NULL ||\n                s->ctx->app_gen_cookie_cb(s, cookie, &cookielen) == 0 ||\n                cookielen > 255) {\n                SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_COOKIE_GEN_CALLBACK_FAILURE);\n                return -1;\n            }\n            p = &buf[DTLS1_RT_HEADER_LENGTH];\n            msglen = dtls_raw_hello_verify_request(p + DTLS1_HM_HEADER_LENGTH,\n                                                   cookie, cookielen);\n            *p++ = DTLS1_MT_HELLO_VERIFY_REQUEST;\n            l2n3(msglen, p);\n            s2n(0, p);\n            l2n3(0, p);\n            l2n3(msglen, p);\n            reclen = msglen + DTLS1_HM_HEADER_LENGTH;\n            p = buf;\n            *(p++) = SSL3_RT_HANDSHAKE;\n            if (s->method->version == DTLS_ANY_VERSION) {\n                *(p++) = DTLS1_VERSION >> 8;\n                *(p++) = DTLS1_VERSION & 0xff;\n            } else {\n                *(p++) = s->version >> 8;\n                *(p++) = s->version & 0xff;\n            }\n            memcpy(p, seq, SEQ_NUM_SIZE);\n            p += SEQ_NUM_SIZE;\n            s2n(reclen, p);\n            reclen += DTLS1_RT_HEADER_LENGTH;\n            if (s->msg_callback)\n                s->msg_callback(1, 0, SSL3_RT_HEADER, buf,\n                                DTLS1_RT_HEADER_LENGTH, s, s->msg_callback_arg);\n            if ((tmpclient = BIO_ADDR_new()) == NULL) {\n                SSLerr(SSL_F_DTLSV1_LISTEN, ERR_R_MALLOC_FAILURE);\n                goto end;\n            }\n            if (BIO_dgram_get_peer(rbio, tmpclient) > 0) {\n                (void)BIO_dgram_set_peer(wbio, tmpclient);\n            }\n            BIO_ADDR_free(tmpclient);\n            tmpclient = NULL;\n            if (BIO_write(wbio, buf, reclen) < (int)reclen) {\n                if (BIO_should_retry(wbio)) {\n                    goto end;\n                }\n                return -1;\n            }\n            if (BIO_flush(wbio) <= 0) {\n                if (BIO_should_retry(wbio)) {\n                    goto end;\n                }\n                return -1;\n            }\n        }\n    } while (next != LISTEN_SUCCESS);\n    s->d1->handshake_read_seq = 1;\n    s->d1->handshake_write_seq = 1;\n    s->d1->next_handshake_write_seq = 1;\n    DTLS_RECORD_LAYER_set_write_sequence(&s->rlayer, seq);\n    SSL_set_options(s, SSL_OP_COOKIE_EXCHANGE);\n    ossl_statem_set_hello_verify_done(s);\n    if (BIO_dgram_get_peer(rbio, client) <= 0)\n        BIO_ADDR_clear(client);\n    ret = 1;\n    clearpkt = 0;\n end:\n    BIO_ADDR_free(tmpclient);\n    BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_PEEK_MODE, 0, NULL);\n    if (clearpkt) {\n        BIO_read(rbio, buf, SSL3_RT_MAX_PLAIN_LENGTH);\n    }\n    return ret;\n}', 'static ossl_inline void packet_forward(PACKET *pkt, size_t len)\n{\n    pkt->curr += len;\n    pkt->remaining -= len;\n}']