ssl/statem/extensions.c:1249: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned64 by call to `PACKET_forward`.
Showing all 10 steps of the trace


ssl/statem/extensions.c:1248:18: Call
1246.   
1247.               /* Find how many bytes are left after the first two messages */
1248.               if (!PACKET_buf_init(&hashprefix, hdata, hdatalen)
                         ^
1249.                       || !PACKET_forward(&hashprefix, 1)
1250.                       || !PACKET_get_length_prefixed_3(&hashprefix, &msg)

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)

ssl/statem/extensions.c:1249:25: Call
1247.               /* Find how many bytes are left after the first two messages */
1248.               if (!PACKET_buf_init(&hashprefix, hdata, hdatalen)
1249.                       || !PACKET_forward(&hashprefix, 1)
                                ^
1250.                       || !PACKET_get_length_prefixed_3(&hashprefix, &msg)
1251.                       || !PACKET_forward(&hashprefix, 1)

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: ([0, +oo] - 1):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;
}
['int tls_psk_do_binder(SSL *s, const EVP_MD *md, const unsigned char *msgstart,\n                      size_t binderoffset, const unsigned char *binderin,\n                      unsigned char *binderout,\n                      SSL_SESSION *sess, int sign)\n{\n    EVP_PKEY *mackey = NULL;\n    EVP_MD_CTX *mctx = NULL;\n    unsigned char hash[EVP_MAX_MD_SIZE], binderkey[EVP_MAX_MD_SIZE];\n    unsigned char finishedkey[EVP_MAX_MD_SIZE], tmpbinder[EVP_MAX_MD_SIZE];\n    const char resumption_label[] = "resumption psk binder key";\n    size_t bindersize, hashsize = EVP_MD_size(md);\n    int ret = -1;\n    if (!tls13_generate_secret(s, md, NULL, sess->master_key,\n                               sess->master_key_length,\n                               (unsigned char *)&s->early_secret)) {\n        SSLerr(SSL_F_TLS_PSK_DO_BINDER, ERR_R_INTERNAL_ERROR);\n        goto err;\n    }\n    mctx = EVP_MD_CTX_new();\n    if (mctx == NULL\n            || EVP_DigestInit_ex(mctx, md, NULL) <= 0\n            || EVP_DigestFinal_ex(mctx, hash, NULL) <= 0) {\n        SSLerr(SSL_F_TLS_PSK_DO_BINDER, ERR_R_INTERNAL_ERROR);\n        goto err;\n    }\n    if (!tls13_hkdf_expand(s, md, s->early_secret,\n                           (unsigned char *)resumption_label,\n                           sizeof(resumption_label) - 1, hash, binderkey,\n                           hashsize)) {\n        SSLerr(SSL_F_TLS_PSK_DO_BINDER, ERR_R_INTERNAL_ERROR);\n        goto err;\n    }\n    if (!tls13_derive_finishedkey(s, md, binderkey, finishedkey, hashsize)) {\n        SSLerr(SSL_F_TLS_PSK_DO_BINDER, ERR_R_INTERNAL_ERROR);\n        goto err;\n    }\n    if (EVP_DigestInit_ex(mctx, md, NULL) <= 0) {\n        SSLerr(SSL_F_TLS_PSK_DO_BINDER, ERR_R_INTERNAL_ERROR);\n        goto err;\n    }\n    if (s->hello_retry_request) {\n        size_t hdatalen;\n        void *hdata;\n        hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);\n        if (hdatalen <= 0) {\n            SSLerr(SSL_F_TLS_PSK_DO_BINDER, SSL_R_BAD_HANDSHAKE_LENGTH);\n            goto err;\n        }\n        if (s->server) {\n            PACKET hashprefix, msg;\n            if (!PACKET_buf_init(&hashprefix, hdata, hdatalen)\n                    || !PACKET_forward(&hashprefix, 1)\n                    || !PACKET_get_length_prefixed_3(&hashprefix, &msg)\n                    || !PACKET_forward(&hashprefix, 1)\n                    || !PACKET_get_length_prefixed_3(&hashprefix, &msg)) {\n                SSLerr(SSL_F_TLS_PSK_DO_BINDER, ERR_R_INTERNAL_ERROR);\n                goto err;\n            }\n            hdatalen -= PACKET_remaining(&hashprefix);\n        }\n        if (EVP_DigestUpdate(mctx, hdata, hdatalen) <= 0) {\n            SSLerr(SSL_F_TLS_PSK_DO_BINDER, ERR_R_INTERNAL_ERROR);\n            goto err;\n        }\n    }\n    if (EVP_DigestUpdate(mctx, msgstart, binderoffset) <= 0\n            || EVP_DigestFinal_ex(mctx, hash, NULL) <= 0) {\n        SSLerr(SSL_F_TLS_PSK_DO_BINDER, ERR_R_INTERNAL_ERROR);\n        goto err;\n    }\n    mackey = EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, NULL, finishedkey, hashsize);\n    if (mackey == NULL) {\n        SSLerr(SSL_F_TLS_PSK_DO_BINDER, ERR_R_INTERNAL_ERROR);\n        goto err;\n    }\n    if (!sign)\n        binderout = tmpbinder;\n    bindersize = hashsize;\n    if (EVP_DigestSignInit(mctx, NULL, md, NULL, mackey) <= 0\n            || EVP_DigestSignUpdate(mctx, hash, hashsize) <= 0\n            || EVP_DigestSignFinal(mctx, binderout, &bindersize) <= 0\n            || bindersize != hashsize) {\n        SSLerr(SSL_F_TLS_PSK_DO_BINDER, ERR_R_INTERNAL_ERROR);\n        goto err;\n    }\n    if (sign) {\n        ret = 1;\n    } else {\n        ret = (CRYPTO_memcmp(binderin, binderout, hashsize) == 0);\n    }\n err:\n    OPENSSL_cleanse(binderkey, sizeof(binderkey));\n    OPENSSL_cleanse(finishedkey, sizeof(finishedkey));\n    EVP_PKEY_free(mackey);\n    EVP_MD_CTX_free(mctx);\n    return ret;\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}']