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


test/tls13ccstest.c:117:25: Call
115.           if (rectype == SSL3_RT_HANDSHAKE) {
116.               if (!PACKET_get_1(&msg, &msgtype)
117.                       || !PACKET_get_length_prefixed_3(&msg, &msgbody))
                               ^
118.                   return 0;
119.               if (msgtype == SSL3_MT_CLIENT_HELLO) {

ssl/packet_locl.h:582:8: Parameter `subpkt->remaining`
  580.    * Upon failure, the original |pkt| and |subpkt| are not modified.
  581.    */
  582.   __owur static ossl_inline int PACKET_get_length_prefixed_3(PACKET *pkt,
                ^
  583.                                                              PACKET *subpkt)
  584.   {

test/tls13ccstest.c:126:22: Call
124.                    * session_id.
125.                    */
126.                   if (!PACKET_forward(&msgbody, 34)
                            ^
127.                           || !PACKET_get_length_prefixed_1(&msgbody, &sessionid))
128.                       return 0;

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 watchccs_write(BIO *bio, const char *in, int inl)\n{\n    int ret = 0;\n    BIO *next = BIO_next(bio);\n    PACKET pkt, msg, msgbody, sessionid;\n    unsigned int rectype, recvers, msgtype, expectedrecvers;\n    if (inl <= 0)\n        return 0;\n    if (next == NULL)\n        return 0;\n    BIO_clear_retry_flags(bio);\n    if (!PACKET_buf_init(&pkt, (const unsigned char *)in, inl))\n        return 0;\n    while (PACKET_remaining(&pkt)) {\n        if (!PACKET_get_1(&pkt, &rectype)\n                || !PACKET_get_net_2(&pkt, &recvers)\n                || !PACKET_get_length_prefixed_2(&pkt, &msg))\n            return 0;\n        expectedrecvers = TLS1_2_VERSION;\n        if (rectype == SSL3_RT_HANDSHAKE) {\n            if (!PACKET_get_1(&msg, &msgtype)\n                    || !PACKET_get_length_prefixed_3(&msg, &msgbody))\n                return 0;\n            if (msgtype == SSL3_MT_CLIENT_HELLO) {\n                chseen++;\n                expectedrecvers = TLS1_VERSION;\n                if (!PACKET_forward(&msgbody, 34)\n                        || !PACKET_get_length_prefixed_1(&msgbody, &sessionid))\n                    return 0;\n                if (chseen == 1) {\n                    chsessidlen = PACKET_remaining(&sessionid);\n                    if (!PACKET_copy_bytes(&sessionid, chsessid, chsessidlen))\n                        return 0;\n                } else {\n                    if (PACKET_remaining(&sessionid) != chsessidlen\n                            || (chsessidlen > 0\n                                && memcmp(chsessid, PACKET_data(&sessionid),\n                                          chsessidlen) != 0))\n                        badsessid = 1;\n                }\n            } else if (msgtype == SSL3_MT_SERVER_HELLO) {\n                shseen++;\n                if (!PACKET_forward(&msgbody, 34)\n                        || !PACKET_get_length_prefixed_1(&msgbody, &sessionid))\n                    return 0;\n                if (PACKET_remaining(&sessionid) != chsessidlen\n                        || (chsessidlen > 0\n                            && memcmp(chsessid, PACKET_data(&sessionid),\n                                      chsessidlen) != 0))\n                    badsessid = 1;\n            }\n        } else if (rectype == SSL3_RT_CHANGE_CIPHER_SPEC) {\n            if (bio == s_to_c_fbio) {\n                if (!sappdataseen\n                        && chseen == 1\n                        && shseen == 1\n                        && !sccsseen)\n                    sccsseen = 1;\n                else\n                    badccs = 1;\n            } else if (!cappdataseen) {\n                if (shseen == 1 && !ccsaftersh)\n                    ccsaftersh = 1;\n                else if (shseen == 0 && !ccsbeforesh)\n                    ccsbeforesh = 1;\n                else\n                    badccs = 1;\n            } else {\n                badccs = 1;\n            }\n        } else if(rectype == SSL3_RT_APPLICATION_DATA) {\n            if (bio == s_to_c_fbio)\n                sappdataseen = 1;\n            else\n                cappdataseen = 1;\n        }\n        if (recvers != expectedrecvers)\n            badvers = 1;\n    }\n    ret = BIO_write(next, in, inl);\n    if (ret <= 0 && BIO_should_write(next))\n        BIO_set_retry_write(bio);\n    return ret;\n}', 'static ossl_inline int PACKET_get_length_prefixed_3(PACKET *pkt,\n                                                           PACKET *subpkt)\n{\n    unsigned long length;\n    const unsigned char *data;\n    PACKET tmp = *pkt;\n    if (!PACKET_get_net_3(&tmp, &length) ||\n        !PACKET_get_bytes(&tmp, &data, (size_t)length)) {\n        return 0;\n    }\n    *pkt = tmp;\n    subpkt->curr = data;\n    subpkt->remaining = length;\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}']