ssl/t1_lib.c:3148: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_put_bytes__`.
Showing all 10 steps of the trace


ssl/t1_lib.c:3148:10: Call
3146.       if (sig_id == -1)
3147.           return 0;
3148.       if (!WPACKET_put_bytes_u8(pkt, md_id) || !WPACKET_put_bytes_u8(pkt, sig_id))
                 ^
3149.           return 0;
3150.   

ssl/packet.c:242:1: Parameter `pkt->buf->length`
  240.   }
  241.   
  242. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
  243.   {
  244.       unsigned char *data;

ssl/t1_lib.c:3148:47: Call
3146.       if (sig_id == -1)
3147.           return 0;
3148.       if (!WPACKET_put_bytes_u8(pkt, md_id) || !WPACKET_put_bytes_u8(pkt, sig_id))
                                                      ^
3149.           return 0;
3150.   

ssl/packet.c:242:1: Parameter `pkt->written`
  240.   }
  241.   
  242. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
  243.   {
  244.       unsigned char *data;

ssl/packet.c:250:17: Call
  248.   
  249.       if (size > sizeof(unsigned int)
  250.               || !WPACKET_allocate_bytes(pkt, size, &data)
                         ^
  251.               || !put_value(data, val, size))
  252.           return 0;

ssl/packet.c:15:1: <LHS trace>
13.   #define DEFAULT_BUF_SIZE    256
14.   
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16.   {
17.       /* Internal API, so should not fail */

ssl/packet.c:15:1: Parameter `pkt->buf->length`
    13.   #define DEFAULT_BUF_SIZE    256
    14.   
    15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
    16.   {
    17.       /* Internal API, so should not fail */

ssl/packet.c:15:1: <RHS trace>
13.   #define DEFAULT_BUF_SIZE    256
14.   
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16.   {
17.       /* Internal API, so should not fail */

ssl/packet.c:15:1: Parameter `len`
    13.   #define DEFAULT_BUF_SIZE    256
    14.   
    15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
    16.   {
    17.       /* Internal API, so should not fail */

ssl/packet.c:25:9: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 4]):unsigned64 by call to `WPACKET_put_bytes__` 
    23.           return 0;
    24.   
    25.       if (pkt->buf->length - pkt->written < len) {
                  ^
    26.           size_t newlen;
    27.           size_t reflen;

int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
{
    assert(pkt->subs != NULL && len != 0);
    if (pkt->subs == NULL || len == 0)
        return 0;
    if (pkt->maxsize - pkt->written < len)
        return 0;
    if (pkt->buf->length - pkt->written < len) {
        size_t newlen;
        size_t reflen;
        reflen = (len > pkt->buf->length) ? len : pkt->buf->length;
        if (reflen > SIZE_MAX / 2) {
            newlen = SIZE_MAX;
        } else {
            newlen = reflen * 2;
            if (newlen < DEFAULT_BUF_SIZE)
                newlen = DEFAULT_BUF_SIZE;
        }
        if (BUF_MEM_grow(pkt->buf, newlen) == 0)
            return 0;
    }
    *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr;
    pkt->written += len;
    pkt->curr += len;
    return 1;
}
['int tls12_get_sigandhash(WPACKET *pkt, const EVP_PKEY *pk, const EVP_MD *md)\n{\n    int sig_id, md_id;\n    if (md == NULL)\n        return 0;\n    md_id = tls12_find_id(EVP_MD_type(md), tls12_md, OSSL_NELEM(tls12_md));\n    if (md_id == -1)\n        return 0;\n    sig_id = tls12_get_sigid(pk);\n    if (sig_id == -1)\n        return 0;\n    if (!WPACKET_put_bytes_u8(pkt, md_id) || !WPACKET_put_bytes_u8(pkt, sig_id))\n        return 0;\n    return 1;\n}', 'int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)\n{\n    unsigned char *data;\n    assert(size <= sizeof(unsigned int));\n    if (size > sizeof(unsigned int)\n            || !WPACKET_allocate_bytes(pkt, size, &data)\n            || !put_value(data, val, size))\n        return 0;\n    return 1;\n}', 'int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)\n{\n    assert(pkt->subs != NULL && len != 0);\n    if (pkt->subs == NULL || len == 0)\n        return 0;\n    if (pkt->maxsize - pkt->written < len)\n        return 0;\n    if (pkt->buf->length - pkt->written < len) {\n        size_t newlen;\n        size_t reflen;\n        reflen = (len > pkt->buf->length) ? len : pkt->buf->length;\n        if (reflen > SIZE_MAX / 2) {\n            newlen = SIZE_MAX;\n        } else {\n            newlen = reflen * 2;\n            if (newlen < DEFAULT_BUF_SIZE)\n                newlen = DEFAULT_BUF_SIZE;\n        }\n        if (BUF_MEM_grow(pkt->buf, newlen) == 0)\n            return 0;\n    }\n    *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr;\n    pkt->written += len;\n    pkt->curr += len;\n    return 1;\n}']