test/bad_dtls_test.c:177: error: INTEGER_OVERFLOW_L2
  ([1, +oo] - 20):unsigned64 by call to `PACKET_starts`.
Showing all 11 steps of the trace


test/bad_dtls_test.c:174:10: Call
172.   
173.       /* Check cookie */
174.       if (!PACKET_get_1(&pkt, &u))
                ^
175.           return 0;
176.       if (u) {

ssl/packet_locl.h:241:10: Call
  239.   __owur static ossl_inline int PACKET_get_1(PACKET *pkt, unsigned int *data)
  240.   {
  241.       if (!PACKET_peek_1(pkt, data))
                  ^
  242.           return 0;
  243.   

ssl/packet_locl.h:227:8: Parameter `*data`
    225.   
    226.   /* Peek ahead at 1 byte from |pkt| and store the value in |*data| */
    227.   __owur static ossl_inline int PACKET_peek_1(const PACKET *pkt,
                  ^
    228.                                               unsigned int *data)
    229.   {

test/bad_dtls_test.c:177:37: Call
175.           return 0;
176.       if (u) {
177.           if (u != sizeof(cookie) || !PACKET_starts(&pkt, cookie, u))
                                           ^
178.               return 0;
179.           cookie_found = 1;

test/bad_dtls_test.c:117:8: Parameter `num`
  115.    * does, in a form that can easily be moved to ssl_locl.h if anyone else
  116.    * cares to come up with a better name and use it too... */
  117.   __owur static ossl_inline int PACKET_starts(PACKET *pkt, const void *ptr,
                ^
  118.                                               size_t num)
  119.   {

test/bad_dtls_test.c:125:5: Call
  123.           return 0;
  124.   
  125.       packet_forward(pkt, num);
             ^
  126.       return 1;
  127.   }

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: ([1, +oo] - 20):unsigned64 by call to `PACKET_starts` 
    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 validate_client_hello(BIO *wbio)\n{\n    PACKET pkt;\n    long len;\n    unsigned char *data;\n    int cookie_found = 0;\n    unsigned int u;\n    len = BIO_get_mem_data(wbio, (char **)&data);\n    if (!PACKET_buf_init(&pkt, data, len))\n        return 0;\n    if (!PACKET_get_1(&pkt, &u) || u != SSL3_RT_HANDSHAKE)\n        return 0;\n    if (!PACKET_get_net_2(&pkt, &u) || u != DTLS1_BAD_VER)\n        return 0;\n    if (!PACKET_forward(&pkt, DTLS1_RT_HEADER_LENGTH - 3))\n        return 0;\n    if (!PACKET_get_1(&pkt, &u) || u != SSL3_MT_CLIENT_HELLO)\n        return 0;\n    if (!PACKET_forward(&pkt, DTLS1_HM_HEADER_LENGTH - 1))\n        return 0;\n    if (!PACKET_get_net_2(&pkt, &u) || u != DTLS1_BAD_VER)\n        return 0;\n    if (!PACKET_copy_bytes(&pkt, client_random, SSL3_RANDOM_SIZE))\n        return 0;\n    if (!PACKET_get_1(&pkt, &u))\n        return 0;\n    if (u != sizeof(session_id) || !PACKET_starts(&pkt, session_id, u))\n        return 0;\n    if (!PACKET_get_1(&pkt, &u))\n        return 0;\n    if (u) {\n        if (u != sizeof(cookie) || !PACKET_starts(&pkt, cookie, u))\n            return 0;\n        cookie_found = 1;\n    }\n    if (!PACKET_get_net_2(&pkt, &u) || !PACKET_forward(&pkt, u))\n        return 0;\n    if (!PACKET_get_1(&pkt, &u) || !PACKET_forward(&pkt, u))\n        return 0;\n    if (!PACKET_get_net_2(&pkt, &u) || !PACKET_forward(&pkt, u))\n        return 0;\n    if (PACKET_remaining(&pkt))\n        return 0;\n    if (cookie_found && !EVP_DigestUpdate(handshake_md, data + MAC_OFFSET,\n                                          len - MAC_OFFSET))\n            printf("EVP_DigestUpdate() failed\\n");\n    (void)BIO_reset(wbio);\n    return 1 + cookie_found;\n}', 'static ossl_inline int PACKET_starts(PACKET *pkt, const void *ptr,\n                                            size_t num)\n{\n    if (PACKET_remaining(pkt) < num)\n        return 0;\n    if (CRYPTO_memcmp(pkt->curr, ptr, num) != 0)\n        return 0;\n    packet_forward(pkt, num);\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}']