test/packettest.c:182: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 4):unsigned64 by call to `PACKET_get_sub_packet`.
Showing all 10 steps of the trace


test/packettest.c:181:17: Call
179.       unsigned long i;
180.   
181.       if (       !PACKET_buf_init(&pkt, buf, BUF_LEN)
                       ^
182.               || !PACKET_get_sub_packet(&pkt, &subpkt, 4)
183.               || !PACKET_get_net_4(&subpkt, &i)

ssl/packet_locl.h:109:1: Parameter `pkt->remaining`
  107.    * is being used.
  108.    */
  109. > static inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf, size_t len)
  110.   {
  111.       /* Sanity check for negative values. */

test/packettest.c:182:17: Call
180.   
181.       if (       !PACKET_buf_init(&pkt, buf, BUF_LEN)
182.               || !PACKET_get_sub_packet(&pkt, &subpkt, 4)
                       ^
183.               || !PACKET_get_net_4(&subpkt, &i)
184.               ||  i != 0x02040608UL

ssl/packet_locl.h:141:8: Parameter `len`
  139.    * original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|.
  140.    */
  141.   __owur static inline int PACKET_get_sub_packet(PACKET *pkt, PACKET *subpkt,
                ^
  142.                                                  size_t len)
  143.   {

ssl/packet_locl.h:147:5: Call
  145.           return 0;
  146.   
  147.       packet_forward(pkt, len);
             ^
  148.   
  149.       return 1;

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

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

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

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

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

static inline void packet_forward(PACKET *pkt, size_t len)
{
    pkt->curr += len;
    pkt->remaining -= len;
}
['static int test_PACKET_get_sub_packet(unsigned char buf[BUF_LEN])\n{\n    PACKET pkt, subpkt;\n    unsigned long i;\n    if (       !PACKET_buf_init(&pkt, buf, BUF_LEN)\n            || !PACKET_get_sub_packet(&pkt, &subpkt, 4)\n            || !PACKET_get_net_4(&subpkt, &i)\n            ||  i != 0x02040608UL\n            ||  PACKET_remaining(&subpkt)\n            || !PACKET_forward(&pkt, BUF_LEN - 8)\n            || !PACKET_get_sub_packet(&pkt, &subpkt, 4)\n            || !PACKET_get_net_4(&subpkt, &i)\n            ||  i != 0xf8fafcfeUL\n            ||  PACKET_remaining(&subpkt)\n            ||  PACKET_get_sub_packet(&pkt, &subpkt, 4)) {\n        fprintf(stderr, "test_PACKET_get_sub_packet() failed\\n");\n        return 0;\n    }\n    return 1;\n}', 'static inline void packet_forward(PACKET *pkt, size_t len)\n{\n    pkt->curr += len;\n    pkt->remaining -= len;\n}']