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


test/packettest.c:130:17: Call
128.       PACKET pkt;
129.   
130.       if (       !PACKET_buf_init(&pkt, buf, BUF_LEN)
                       ^
131.               || !PACKET_get_net_4(&pkt, &i)
132.               ||  i != 0x02040608UL

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:131:17: Call
129.   
130.       if (       !PACKET_buf_init(&pkt, buf, BUF_LEN)
131.               || !PACKET_get_net_4(&pkt, &i)
                       ^
132.               ||  i != 0x02040608UL
133.               || !PACKET_forward(&pkt, BUF_LEN - 8)

ssl/packet_locl.h:236:8: Parameter `pkt->remaining`
  234.   /* Equivalent of n2l */
  235.   /* Get 4 bytes in network order from |pkt| and store the value in |*data| */
  236.   __owur static ossl_inline int PACKET_get_net_4(PACKET *pkt, unsigned long *data)
                ^
  237.   {
  238.       if (!PACKET_peek_net_4(pkt, data))

ssl/packet_locl.h:238:10: Call
  236.   __owur static ossl_inline int PACKET_get_net_4(PACKET *pkt, unsigned long *data)
  237.   {
  238.       if (!PACKET_peek_net_4(pkt, data))
                  ^
  239.           return 0;
  240.   

ssl/packet_locl.h:220:8: Parameter `pkt->remaining`
    218.    * |*data|
    219.    */
    220.   __owur static ossl_inline int PACKET_peek_net_4(const PACKET *pkt,
                  ^
    221.                                                   unsigned long *data)
    222.   {

test/packettest.c:133:17: Call
131.               || !PACKET_get_net_4(&pkt, &i)
132.               ||  i != 0x02040608UL
133.               || !PACKET_forward(&pkt, BUF_LEN - 8)
                       ^
134.               || !PACKET_get_net_4(&pkt, &i)
135.               ||  i != 0xf8fafcfeUL

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: ([4, +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_net_4(unsigned char buf[BUF_LEN])\n{\n    unsigned long i;\n    PACKET pkt;\n    if (       !PACKET_buf_init(&pkt, buf, BUF_LEN)\n            || !PACKET_get_net_4(&pkt, &i)\n            ||  i != 0x02040608UL\n            || !PACKET_forward(&pkt, BUF_LEN - 8)\n            || !PACKET_get_net_4(&pkt, &i)\n            ||  i != 0xf8fafcfeUL\n            ||  PACKET_get_net_4(&pkt, &i)) {\n        fprintf(stderr, "test_PACKET_get_net_4() failed\\n");\n        return 0;\n    }\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_net_4(PACKET *pkt, unsigned long *data)\n{\n    if (!PACKET_peek_net_4(pkt, data))\n        return 0;\n    packet_forward(pkt, 4);\n    return 1;\n}', 'static ossl_inline int PACKET_peek_net_4(const PACKET *pkt,\n                                                unsigned long *data)\n{\n    if (PACKET_remaining(pkt) < 4)\n        return 0;\n    *data = ((unsigned long)(*pkt->curr)) << 24;\n    *data |= ((unsigned long)(*(pkt->curr + 1))) << 16;\n    *data |= ((unsigned long)(*(pkt->curr + 2))) << 8;\n    *data |= *(pkt->curr + 3);\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}']