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


test/packettest.c:162:17: Call
160.       PACKET pkt;
161.   
162.       if (       !PACKET_buf_init(&pkt, buf, BUF_LEN)
                       ^
163.               || !PACKET_get_net_4(&pkt, &i)
164.               ||  i != 0x02040608UL

ssl/packet_locl.h:110:8: Parameter `pkt->remaining`
  108.    * is being used.
  109.    */
  110.   __owur static inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf,
                ^
  111.                                            size_t len)
  112.   {

test/packettest.c:163:17: Call
161.   
162.       if (       !PACKET_buf_init(&pkt, buf, BUF_LEN)
163.               || !PACKET_get_net_4(&pkt, &i)
                       ^
164.               ||  i != 0x02040608UL
165.               || !PACKET_forward(&pkt, BUF_LEN - 8)

ssl/packet_locl.h:245:8: Parameter `pkt->remaining`
  243.   /* Equivalent of n2l */
  244.   /* Get 4 bytes in network order from |pkt| and store the value in |*data| */
  245.   __owur static inline int PACKET_get_net_4(PACKET *pkt, unsigned long *data)
                ^
  246.   {
  247.       if (!PACKET_peek_net_4(pkt, data))

ssl/packet_locl.h:247:10: Call
  245.   __owur static inline int PACKET_get_net_4(PACKET *pkt, unsigned long *data)
  246.   {
  247.       if (!PACKET_peek_net_4(pkt, data))
                  ^
  248.           return 0;
  249.   

ssl/packet_locl.h:229:8: Parameter `pkt->remaining`
    227.    * |*data|
    228.    */
    229.   __owur static inline int PACKET_peek_net_4(const PACKET *pkt,
                  ^
    230.                                              unsigned long *data)
    231.   {

test/packettest.c:165:17: Call
163.               || !PACKET_get_net_4(&pkt, &i)
164.               ||  i != 0x02040608UL
165.               || !PACKET_forward(&pkt, BUF_LEN - 8)
                       ^
166.               || !PACKET_get_net_4(&pkt, &i)
167.               ||  i != 0xf8fafcfeUL

ssl/packet_locl.h:440:8: Parameter `len`
  438.   
  439.   /* Move the current reading position forward |len| bytes */
  440.   __owur static inline int PACKET_forward(PACKET *pkt, size_t len)
                ^
  441.   {
  442.       if (PACKET_remaining(pkt) < len)

ssl/packet_locl.h:445:5: Call
  443.           return 0;
  444.   
  445.       packet_forward(pkt, len);
             ^
  446.   
  447.       return 1;

ssl/packet_locl.h:80:1: <LHS trace>
78.   
79.   /* Internal unchecked shorthand; don't use outside this file. */
80. > static inline void packet_forward(PACKET *pkt, size_t len)
81.   {
82.       pkt->curr += len;

ssl/packet_locl.h:80:1: Parameter `pkt->remaining`
    78.   
    79.   /* Internal unchecked shorthand; don't use outside this file. */
    80. > static inline void packet_forward(PACKET *pkt, size_t len)
    81.   {
    82.       pkt->curr += len;

ssl/packet_locl.h:80:1: <RHS trace>
78.   
79.   /* Internal unchecked shorthand; don't use outside this file. */
80. > static inline void packet_forward(PACKET *pkt, size_t len)
81.   {
82.       pkt->curr += len;

ssl/packet_locl.h:80:1: Parameter `len`
    78.   
    79.   /* Internal unchecked shorthand; don't use outside this file. */
    80. > static inline void packet_forward(PACKET *pkt, size_t len)
    81.   {
    82.       pkt->curr += len;

ssl/packet_locl.h:83:5: Binary operation: ([4, +oo] - 247):unsigned64 by call to `PACKET_forward` 
    81.   {
    82.       pkt->curr += len;
    83.       pkt->remaining -= len;
              ^
    84.   }
    85.   

static 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}', '__owur static inline int PACKET_buf_init(PACKET *pkt, 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}', '__owur static 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}', '__owur static 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}', '__owur static 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 inline void packet_forward(PACKET *pkt, size_t len)\n{\n    pkt->curr += len;\n    pkt->remaining -= len;\n}']