test/asynciotest.c:164: error: INTEGER_OVERFLOW_L2
  ([1, +oo] - 3):unsigned64 by call to `PACKET_forward`.
Showing all 12 steps of the trace


test/asynciotest.c:160:29: Call
158.                   wholebody = payload;
159.                   if (contenttype == SSL3_RT_HANDSHAKE
160.                           && !PACKET_get_1(&wholebody, &msgtype))
                                   ^
161.                       abort();
162.   

ssl/packet_locl.h:271:8: Parameter `pkt->remaining`
  269.   
  270.   /* Get 1 byte from |pkt| and store the value in |*data| */
  271.   __owur static ossl_inline int PACKET_get_1(PACKET *pkt, unsigned int *data)
                ^
  272.   {
  273.       if (!PACKET_peek_1(pkt, data))

ssl/packet_locl.h:273:10: Call
  271.   __owur static ossl_inline int PACKET_get_1(PACKET *pkt, unsigned int *data)
  272.   {
  273.       if (!PACKET_peek_1(pkt, data))
                  ^
  274.           return 0;
  275.   

ssl/packet_locl.h:259:8: Parameter `pkt->remaining`
    257.   
    258.   /* Peek ahead at 1 byte from |pkt| and store the value in |*data| */
    259.   __owur static ossl_inline int PACKET_peek_1(const PACKET *pkt,
                  ^
    260.                                               unsigned int *data)
    261.   {

test/asynciotest.c:164:30: Call
162.   
163.                   if (msgtype == SSL3_MT_SERVER_HELLO
164.                           && (!PACKET_forward(&wholebody,
                                    ^
165.                                               SSL3_HM_HEADER_LENGTH - 1)
166.                               || !PACKET_get_net_2(&wholebody, &negversion)))

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: ([1, +oo] - 3):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 async_write(BIO *bio, const char *in, int inl)\n{\n    struct async_ctrs *ctrs;\n    int ret = 0;\n    size_t written = 0;\n    BIO *next = BIO_next(bio);\n    if (inl <= 0)\n        return 0;\n    if (next == NULL)\n        return 0;\n    ctrs = BIO_get_data(bio);\n    BIO_clear_retry_flags(bio);\n    if (ctrs->wctr > 0) {\n        ctrs->wctr = 0;\n        if (fragment) {\n            PACKET pkt;\n            if (!PACKET_buf_init(&pkt, (const unsigned char *)in, inl))\n                abort();\n            while (PACKET_remaining(&pkt) > 0) {\n                PACKET payload, wholebody;\n                unsigned int contenttype, versionhi, versionlo, data;\n                unsigned int msgtype = 0, negversion = 0;\n                if (   !PACKET_get_1(&pkt, &contenttype)\n                    || !PACKET_get_1(&pkt, &versionhi)\n                    || !PACKET_get_1(&pkt, &versionlo)\n                    || !PACKET_get_length_prefixed_2(&pkt, &payload))\n                    abort();\n                written += SSL3_RT_HEADER_LENGTH;\n                wholebody = payload;\n                if (contenttype == SSL3_RT_HANDSHAKE\n                        && !PACKET_get_1(&wholebody, &msgtype))\n                    abort();\n                if (msgtype == SSL3_MT_SERVER_HELLO\n                        && (!PACKET_forward(&wholebody,\n                                            SSL3_HM_HEADER_LENGTH - 1)\n                            || !PACKET_get_net_2(&wholebody, &negversion)))\n                    abort();\n                while (PACKET_get_1(&payload, &data)) {\n                    char smallrec[MIN_RECORD_LEN] = {\n                        0,\n                        0,\n                        0,\n                        0,\n                        1,\n                        0\n                    };\n                    smallrec[CONTENTTYPEPOS] = contenttype;\n                    smallrec[VERSIONHIPOS] = versionhi;\n                    smallrec[VERSIONLOPOS] = versionlo;\n                    smallrec[DATAPOS] = data;\n                    ret = BIO_write(next, smallrec, MIN_RECORD_LEN);\n                    if (ret <= 0)\n                        abort();\n                    written++;\n                }\n                if (contenttype == SSL3_RT_CHANGE_CIPHER_SPEC\n                        || (negversion == TLS1_3_VERSION_DRAFT\n                            && msgtype == SSL3_MT_SERVER_HELLO)) {\n                    fragment = 0;\n                    break;\n                }\n            }\n        }\n        ret = 0;\n        if ((int)written < inl) {\n            ret = BIO_write(next, in + written , inl - written);\n        }\n        if (ret <= 0 && BIO_should_write(next))\n            BIO_set_retry_write(bio);\n        else\n            ret += written;\n    } else {\n        ctrs->wctr++;\n        BIO_set_retry_write(bio);\n    }\n    return ret;\n}', 'static ossl_inline int PACKET_get_1(PACKET *pkt, unsigned int *data)\n{\n    if (!PACKET_peek_1(pkt, data))\n        return 0;\n    packet_forward(pkt, 1);\n    return 1;\n}', 'static ossl_inline int PACKET_peek_1(const PACKET *pkt,\n                                            unsigned int *data)\n{\n    if (!PACKET_remaining(pkt))\n        return 0;\n    *data = *pkt->curr;\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}']