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


test/packettest.c:160:10: Call
158.       PACKET pkt;
159.   
160.       if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN))
                ^
161.               || !TEST_true(PACKET_get_bytes(&pkt, &bytes, 4))
162.               || !TEST_uchar_eq(bytes[0], 2)

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/packettest.c:161:17: Call
159.   
160.       if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN))
161.               || !TEST_true(PACKET_get_bytes(&pkt, &bytes, 4))
                       ^
162.               || !TEST_uchar_eq(bytes[0], 2)
163.               || !TEST_uchar_eq(bytes[1], 4)

ssl/packet_locl.h:350:8: Parameter `pkt->remaining`
  348.    * freed
  349.    */
  350.   __owur static ossl_inline int PACKET_get_bytes(PACKET *pkt,
                ^
  351.                                                  const unsigned char **data,
  352.                                                  size_t len)

ssl/packet_locl.h:354:10: Call
  352.                                                  size_t len)
  353.   {
  354.       if (!PACKET_peek_bytes(pkt, data, len))
                  ^
  355.           return 0;
  356.   

ssl/packet_locl.h:332:8: Parameter `len`
    330.    * underlying buffer gets freed
    331.    */
    332.   __owur static ossl_inline int PACKET_peek_bytes(const PACKET *pkt,
                  ^
    333.                                                   const unsigned char **data,
    334.                                                   size_t len)

test/packettest.c:167:17: Call
165.               || !TEST_uchar_eq(bytes[3], 8)
166.               || !TEST_size_t_eq(PACKET_remaining(&pkt), BUF_LEN -4)
167.               || !TEST_true(PACKET_forward(&pkt, BUF_LEN - 8))
                       ^
168.               || !TEST_true(PACKET_get_bytes(&pkt, &bytes, 4))
169.               || !TEST_uchar_eq(bytes[0], 0xf8)

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] - 247):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_PACKET_get_bytes()\n{\n    const unsigned char *bytes;\n    PACKET pkt;\n    if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN))\n            || !TEST_true(PACKET_get_bytes(&pkt, &bytes, 4))\n            || !TEST_uchar_eq(bytes[0], 2)\n            || !TEST_uchar_eq(bytes[1], 4)\n            || !TEST_uchar_eq(bytes[2], 6)\n            || !TEST_uchar_eq(bytes[3], 8)\n            || !TEST_size_t_eq(PACKET_remaining(&pkt), BUF_LEN -4)\n            || !TEST_true(PACKET_forward(&pkt, BUF_LEN - 8))\n            || !TEST_true(PACKET_get_bytes(&pkt, &bytes, 4))\n            || !TEST_uchar_eq(bytes[0], 0xf8)\n            || !TEST_uchar_eq(bytes[1], 0xfa)\n            || !TEST_uchar_eq(bytes[2], 0xfc)\n            || !TEST_uchar_eq(bytes[3], 0xfe)\n            || !TEST_false(PACKET_remaining(&pkt)))\n        return 0;\n    return 1;\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_get_bytes(PACKET *pkt,\n                                               const unsigned char **data,\n                                               size_t len)\n{\n    if (!PACKET_peek_bytes(pkt, data, len))\n        return 0;\n    packet_forward(pkt, len);\n    return 1;\n}', 'static ossl_inline int PACKET_peek_bytes(const PACKET *pkt,\n                                                const unsigned char **data,\n                                                size_t len)\n{\n    if (PACKET_remaining(pkt) < len)\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}']