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


test/packettest.c:226:10: Call
224.       int result = 0;
225.   
226.       if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN))
                ^
227.               || !TEST_true(PACKET_memdup(&pkt, &data, &len))
228.               || !TEST_size_t_eq(len, BUF_LEN)

include/internal/packet.h:68:8: Parameter `pkt->remaining`
  66.    * is being used.
  67.    */
  68.   __owur static ossl_inline int PACKET_buf_init(PACKET *pkt,
               ^
  69.                                                 const unsigned char *buf,
  70.                                                 size_t len)

test/packettest.c:230:17: Call
228.               || !TEST_size_t_eq(len, BUF_LEN)
229.               || !TEST_mem_eq(data, len, PACKET_data(&pkt), len)
230.               || !TEST_true(PACKET_forward(&pkt, 10))
                       ^
231.               || !TEST_true(PACKET_memdup(&pkt, &data, &len))
232.               || !TEST_size_t_eq(len, BUF_LEN - 10)

include/internal/packet.h:463:8: Parameter `len`
  461.   
  462.   /* Move the current reading position forward |len| bytes */
  463.   __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len)
                ^
  464.   {
  465.       if (PACKET_remaining(pkt) < len)

include/internal/packet.h:468:5: Call
  466.           return 0;
  467.   
  468.       packet_forward(pkt, len);
             ^
  469.   
  470.       return 1;

include/internal/packet.h:29:1: <LHS trace>
27.   
28.   /* Internal unchecked shorthand; don't use outside this file. */
29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
30.   {
31.       pkt->curr += len;

include/internal/packet.h:29:1: Parameter `pkt->remaining`
    27.   
    28.   /* Internal unchecked shorthand; don't use outside this file. */
    29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
    30.   {
    31.       pkt->curr += len;

include/internal/packet.h:29:1: <RHS trace>
27.   
28.   /* Internal unchecked shorthand; don't use outside this file. */
29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
30.   {
31.       pkt->curr += len;

include/internal/packet.h:29:1: Parameter `len`
    27.   
    28.   /* Internal unchecked shorthand; don't use outside this file. */
    29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
    30.   {
    31.       pkt->curr += len;

include/internal/packet.h:32:5: Binary operation: ([0, +oo] - 10):unsigned64 by call to `PACKET_forward` 
    30.   {
    31.       pkt->curr += len;
    32.       pkt->remaining -= len;
              ^
    33.   }
    34.   

static ossl_inline void packet_forward(PACKET *pkt, size_t len)
{
    pkt->curr += len;
    pkt->remaining -= len;
}
['static int test_PACKET_memdup(void)\n{\n    unsigned char *data = NULL;\n    size_t len;\n    PACKET pkt;\n    int result = 0;\n    if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN))\n            || !TEST_true(PACKET_memdup(&pkt, &data, &len))\n            || !TEST_size_t_eq(len, BUF_LEN)\n            || !TEST_mem_eq(data, len, PACKET_data(&pkt), len)\n            || !TEST_true(PACKET_forward(&pkt, 10))\n            || !TEST_true(PACKET_memdup(&pkt, &data, &len))\n            || !TEST_size_t_eq(len, BUF_LEN - 10)\n            || !TEST_mem_eq(data, len, PACKET_data(&pkt), len))\n        goto end;\n    result = 1;\nend:\n    OPENSSL_free(data);\n    return result;\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_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}']