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


test/clienthellotest.c:166:10: Call
164.   
165.       len = BIO_get_mem_data(wbio, (char **)&data);
166.       if (!PACKET_buf_init(&pkt, data, len))
                ^
167.           goto end;
168.   

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:170:10: Call
168.   
169.       /* Skip the record header */
170.       if (!PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH))
                ^
171.           goto end;
172.   

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:176:10: Call
174.   
175.       /* Skip the handshake message header */
176.       if (!PACKET_forward(&pkt, SSL3_HM_HEADER_LENGTH))
                ^
177.           goto end;
178.   

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:180:10: Call
178.   
179.       /* Skip client version and random */
180.       if (!PACKET_forward(&pkt, CLIENT_VERSION_LEN + SSL3_RANDOM_SIZE))
                ^
181.           goto end;
182.   

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] - 34):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;\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 (ctx == NULL)\n        goto end;\n    switch(currtest) {\n    case TEST_SET_SESSION_TICK_DATA_VER_NEG:\n        if (!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                && (!SSL_CTX_set_cipher_list(ctx, "ALL")\n                    || SSL_CTX_set_alpn_protos(ctx,\n                                               (unsigned char *)alpn_prots,\n                                               sizeof(alpn_prots) - 1)))\n            goto end;\n        else if (currtest == TEST_PADDING_NOT_NEEDED)\n            testresult = 1;\n        break;\n    default:\n        goto end;\n    }\n    con = SSL_new(ctx);\n    if (con == NULL)\n        goto end;\n    if (currtest == TEST_ADD_PADDING_AND_PSK) {\n        sessbio = BIO_new_file(sessionfile, "r");\n        if (sessbio == NULL) {\n            printf("Unable to open session.pem\\n");\n            goto end;\n        }\n        sess = PEM_read_bio_SSL_SESSION(sessbio, NULL, NULL, NULL);\n        if (sess == NULL) {\n            printf("Unable to load SSL_SESSION\\n");\n            goto end;\n        }\n        if (!SSL_SESSION_set_time(sess, time(NULL))) {\n            printf("Unable to set creation time on SSL_SESSION\\n");\n            goto end;\n        }\n        if (!SSL_set_session(con, sess)) {\n            printf("Unable to set the session on the connection\\n");\n            goto end;\n        }\n    }\n    rbio = BIO_new(BIO_s_mem());\n    wbio = BIO_new(BIO_s_mem());\n    if (rbio == NULL || wbio == NULL) {\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 (!SSL_set_session_ticket_ext(con, dummytick, strlen(dummytick)))\n            goto end;\n    }\n    if (SSL_connect(con) > 0) {\n        goto end;\n    }\n    len = BIO_get_mem_data(wbio, (char **)&data);\n    if (!PACKET_buf_init(&pkt, data, len))\n        goto end;\n    if (!PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH))\n        goto end;\n    msglen = PACKET_remaining(&pkt);\n    if (!PACKET_forward(&pkt, SSL3_HM_HEADER_LENGTH))\n        goto end;\n    if (!PACKET_forward(&pkt, CLIENT_VERSION_LEN + SSL3_RANDOM_SIZE))\n        goto end;\n    if (!PACKET_get_length_prefixed_1(&pkt, &pkt2))\n        goto end;\n    if (!PACKET_get_length_prefixed_2(&pkt, &pkt2))\n        goto end;\n    if (!PACKET_get_length_prefixed_1(&pkt, &pkt2))\n        goto end;\n    if (!PACKET_as_length_prefixed_2(&pkt, &pkt2))\n        goto end;\n    while (PACKET_remaining(&pkt2)) {\n        if (!PACKET_get_net_2(&pkt2, &type) ||\n            !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 (PACKET_equal(&pkt3, dummytick, strlen(dummytick))) {\n                    testresult = 1;\n                } else {\n                    printf("Received session ticket is not as expected\\n");\n                }\n                break;\n            }\n        }\n        if (type == TLSEXT_TYPE_padding) {\n            if (currtest == TEST_ADD_PADDING\n                    || currtest == TEST_ADD_PADDING_AND_PSK)\n                testresult = (msglen == F5_WORKAROUND_MAX_MSG_LEN);\n            else\n                testresult = 0;\n        }\n    }\nend:\n    SSL_free(con);\n    SSL_CTX_free(ctx);\n    SSL_SESSION_free(sess);\n    BIO_free(sessbio);\n    if (!testresult)\n        printf("ClientHello test: FAILED (Test %d)\\n", currtest);\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}']