test/clienthellotest.c:167: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 4):unsigned64 by call to `PACKET_forward`.
Showing all 12 steps of the trace


test/clienthellotest.c:159:10: Call
157.   
158.       len = BIO_get_mem_data(wbio, (char **)&data);
159.       if (!TEST_true(PACKET_buf_init(&pkt, data, len))
                ^
160.                  /* Skip the record header */
161.               || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH))

ssl/packet_locl.h:72:8: Parameter `pkt->remaining`
  70.    * is being used.
  71.    */
  72.   __owur static ossl_inline int PACKET_buf_init(PACKET *pkt,
               ^
  73.                                                 const unsigned char *buf,
  74.                                                 size_t len)

test/clienthellotest.c:161:17: Call
159.       if (!TEST_true(PACKET_buf_init(&pkt, data, len))
160.                  /* Skip the record header */
161.               || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH))
                       ^
162.           goto end;
163.   

ssl/packet_locl.h:467:8: Parameter `len`
  465.   
  466.   /* Move the current reading position forward |len| bytes */
  467.   __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len)
                ^
  468.   {
  469.       if (PACKET_remaining(pkt) < len)

test/clienthellotest.c:167:10: Call
165.   
166.       /* Skip the handshake message header */
167.       if (!TEST_true(PACKET_forward(&pkt, SSL3_HM_HEADER_LENGTH))
                ^
168.                  /* Skip client version and random */
169.               || !TEST_true(PACKET_forward(&pkt, CLIENT_VERSION_LEN

ssl/packet_locl.h:467:8: Parameter `len`
  465.   
  466.   /* Move the current reading position forward |len| bytes */
  467.   __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len)
                ^
  468.   {
  469.       if (PACKET_remaining(pkt) < len)

ssl/packet_locl.h:472:5: Call
  470.           return 0;
  471.   
  472.       packet_forward(pkt, len);
             ^
  473.   
  474.       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: ([0, +oo] - 4):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;
}
['static int test_client_hello(int currtest)\n{\n    SSL_CTX *ctx;\n    SSL *con = NULL;\n    BIO *rbio;\n    BIO *wbio;\n    long len;\n    unsigned char *data;\n    PACKET pkt, pkt2, pkt3;\n    char *dummytick = "Hello World!";\n    unsigned int type = 0;\n    int testresult = 0;\n    size_t msglen;\n    BIO *sessbio = NULL;\n    SSL_SESSION *sess = NULL;\n#ifdef OPENSSL_NO_TLS1_3\n    if (currtest == TEST_ADD_PADDING_AND_PSK)\n        return 1;\n#endif\n    ctx = SSL_CTX_new(TLS_method());\n    if (!TEST_ptr(ctx))\n        goto end;\n    switch(currtest) {\n    case TEST_SET_SESSION_TICK_DATA_VER_NEG:\n        if (!TEST_true(SSL_CTX_set_max_proto_version(ctx, TLS1_2_VERSION)))\n            goto end;\n        break;\n    case TEST_ADD_PADDING_AND_PSK:\n    case TEST_ADD_PADDING:\n    case TEST_PADDING_NOT_NEEDED:\n        SSL_CTX_set_options(ctx, SSL_OP_TLSEXT_PADDING);\n        if (currtest == TEST_ADD_PADDING\n                && (!TEST_true(SSL_CTX_set_cipher_list(ctx, "ALL"))\n                    || !TEST_false(SSL_CTX_set_alpn_protos(ctx,\n                                               (unsigned char *)alpn_prots,\n                                               sizeof(alpn_prots) - 1))))\n            goto end;\n        break;\n    default:\n        goto end;\n    }\n    con = SSL_new(ctx);\n    if (!TEST_ptr(con))\n        goto end;\n    if (currtest == TEST_ADD_PADDING_AND_PSK) {\n        sessbio = BIO_new_file(sessionfile, "r");\n        if (!TEST_ptr(sessbio)) {\n            TEST_info("Unable to open session.pem");\n            goto end;\n        }\n        sess = PEM_read_bio_SSL_SESSION(sessbio, NULL, NULL, NULL);\n        if (!TEST_ptr(sess)) {\n            TEST_info("Unable to load SSL_SESSION");\n            goto end;\n        }\n        if (!TEST_true(SSL_SESSION_set_time(sess, time(NULL)))\n                || !TEST_true(SSL_set_session(con, sess)))\n            goto end;\n    }\n    rbio = BIO_new(BIO_s_mem());\n    wbio = BIO_new(BIO_s_mem());\n    if (!TEST_ptr(rbio)|| !TEST_ptr(wbio)) {\n        BIO_free(rbio);\n        BIO_free(wbio);\n        goto end;\n    }\n    SSL_set_bio(con, rbio, wbio);\n    SSL_set_connect_state(con);\n    if (currtest == TEST_SET_SESSION_TICK_DATA_VER_NEG) {\n        if (!TEST_true(SSL_set_session_ticket_ext(con, dummytick,\n                                                  strlen(dummytick))))\n            goto end;\n    }\n    if (!TEST_int_le(SSL_connect(con), 0)) {\n        goto end;\n    }\n    len = BIO_get_mem_data(wbio, (char **)&data);\n    if (!TEST_true(PACKET_buf_init(&pkt, data, len))\n            || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH))\n        goto end;\n    msglen = PACKET_remaining(&pkt);\n    if (!TEST_true(PACKET_forward(&pkt, SSL3_HM_HEADER_LENGTH))\n            || !TEST_true(PACKET_forward(&pkt, CLIENT_VERSION_LEN\n                                               + SSL3_RANDOM_SIZE))\n            || !TEST_true(PACKET_get_length_prefixed_1(&pkt, &pkt2))\n            || !TEST_true(PACKET_get_length_prefixed_2(&pkt, &pkt2))\n            || !TEST_true(PACKET_get_length_prefixed_1(&pkt, &pkt2))\n            || !TEST_true(PACKET_as_length_prefixed_2(&pkt, &pkt2)))\n        goto end;\n    while (PACKET_remaining(&pkt2)) {\n        if (!TEST_true(PACKET_get_net_2(&pkt2, &type))\n                || !TEST_true(PACKET_get_length_prefixed_2(&pkt2, &pkt3)))\n            goto end;\n        if (type == TLSEXT_TYPE_session_ticket) {\n            if (currtest == TEST_SET_SESSION_TICK_DATA_VER_NEG) {\n                if (TEST_true(PACKET_equal(&pkt3, dummytick,\n                                           strlen(dummytick)))) {\n                    testresult = 1;\n                }\n                goto end;\n            }\n        }\n        if (type == TLSEXT_TYPE_padding) {\n            if (!TEST_false(currtest == TEST_PADDING_NOT_NEEDED))\n                goto end;\n            else if (TEST_true(currtest == TEST_ADD_PADDING\n                    || currtest == TEST_ADD_PADDING_AND_PSK))\n                testresult = TEST_true(msglen == F5_WORKAROUND_MAX_MSG_LEN);\n        }\n    }\n    if (currtest == TEST_PADDING_NOT_NEEDED)\n        testresult = 1;\nend:\n    SSL_free(con);\n    SSL_CTX_free(ctx);\n    SSL_SESSION_free(sess);\n    BIO_free(sessbio);\n    return testresult;\n}', 'static ossl_inline int PACKET_buf_init(PACKET *pkt,\n                                              const unsigned char *buf,\n                                              size_t len)\n{\n    if (len > (size_t)(SIZE_MAX / 2))\n        return 0;\n    pkt->curr = buf;\n    pkt->remaining = len;\n    return 1;\n}', 'static ossl_inline int PACKET_forward(PACKET *pkt, size_t len)\n{\n    if (PACKET_remaining(pkt) < len)\n        return 0;\n    packet_forward(pkt, len);\n    return 1;\n}', 'static ossl_inline void packet_forward(PACKET *pkt, size_t len)\n{\n    pkt->curr += len;\n    pkt->remaining -= len;\n}']