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


test/packettest.c:139:10: Call
137.       unsigned long i;
138.   
139.       if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN))
                ^
140.               || !TEST_true(PACKET_get_sub_packet(&pkt, &subpkt, 4))
141.               || !TEST_true(PACKET_get_net_4(&subpkt, &i))

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:140:17: Call
138.   
139.       if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN))
140.               || !TEST_true(PACKET_get_sub_packet(&pkt, &subpkt, 4))
                       ^
141.               || !TEST_true(PACKET_get_net_4(&subpkt, &i))
142.               || !TEST_ulong_eq(i, 0x02040608UL)

ssl/packet_locl.h:124:8: Parameter `pkt->remaining`
  122.    * original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|.
  123.    */
  124.   __owur static ossl_inline int PACKET_get_sub_packet(PACKET *pkt,
                ^
  125.                                                       PACKET *subpkt, size_t len)
  126.   {

ssl/packet_locl.h:127:10: Call
  125.                                                       PACKET *subpkt, size_t len)
  126.   {
  127.       if (!PACKET_peek_sub_packet(pkt, subpkt, len))
                  ^
  128.           return 0;
  129.   

ssl/packet_locl.h:110:8: Parameter `len`
    108.    * the original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|.
    109.    */
    110.   __owur static ossl_inline int PACKET_peek_sub_packet(const PACKET *pkt,
                  ^
    111.                                                        PACKET *subpkt, size_t len)
    112.   {

test/packettest.c:144:17: Call
142.               || !TEST_ulong_eq(i, 0x02040608UL)
143.               || !TEST_size_t_eq(PACKET_remaining(&subpkt), 0)
144.               || !TEST_true(PACKET_forward(&pkt, BUF_LEN - 8))
                       ^
145.               || !TEST_true(PACKET_get_sub_packet(&pkt, &subpkt, 4))
146.               || !TEST_true(PACKET_get_net_4(&subpkt, &i))

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_sub_packet()\n{\n    PACKET pkt, subpkt;\n    unsigned long i;\n    if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN))\n            || !TEST_true(PACKET_get_sub_packet(&pkt, &subpkt, 4))\n            || !TEST_true(PACKET_get_net_4(&subpkt, &i))\n            || !TEST_ulong_eq(i, 0x02040608UL)\n            || !TEST_size_t_eq(PACKET_remaining(&subpkt), 0)\n            || !TEST_true(PACKET_forward(&pkt, BUF_LEN - 8))\n            || !TEST_true(PACKET_get_sub_packet(&pkt, &subpkt, 4))\n            || !TEST_true(PACKET_get_net_4(&subpkt, &i))\n            || !TEST_ulong_eq(i, 0xf8fafcfeUL)\n            || !TEST_size_t_eq(PACKET_remaining(&subpkt), 0)\n            || !TEST_false(PACKET_get_sub_packet(&pkt, &subpkt, 4)))\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_sub_packet(PACKET *pkt,\n                                                    PACKET *subpkt, size_t len)\n{\n    if (!PACKET_peek_sub_packet(pkt, subpkt, len))\n        return 0;\n    packet_forward(pkt, len);\n    return 1;\n}', 'static ossl_inline int PACKET_peek_sub_packet(const PACKET *pkt,\n                                                     PACKET *subpkt, size_t len)\n{\n    if (PACKET_remaining(pkt) < len)\n        return 0;\n    return PACKET_buf_init(subpkt, pkt->curr, len);\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}']