crypto/cms/cms_pwri.c:263: error: INTEGER_OVERFLOW_L2
  (0 - [-oo, 32]):unsigned64 by call to `EVP_EncryptUpdate`.
Showing all 6 steps of the trace


crypto/cms/cms_pwri.c:263:14: Call
261.               return 0;
262.           /* Encrypt twice */
263.           if (!EVP_EncryptUpdate(ctx, out, &dummy, out, olen)
                    ^
264.               || !EVP_EncryptUpdate(ctx, out, &dummy, out, olen))
265.               return 0;

crypto/evp/evp_enc.c:294:1: Parameter `inl`
  292.   }
  293.   
  294. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
  295.                         const unsigned char *in, int inl)
  296.   {

crypto/evp/evp_enc.c:345:17: Call
  343.               inl -= j;
  344.               in += j;
  345.               if (is_partially_overlapping(out, in, bl)) {
                         ^
  346.   	        EVPerr(EVP_F_EVP_ENCRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);
  347.                   return 0;

crypto/evp/evp_enc.c:279:1: <RHS trace>
277.   #endif
278.   
279. > static int is_partially_overlapping(const void *ptr1, const void *ptr2,
280.                                       int len)
281.   {

crypto/evp/evp_enc.c:279:1: Parameter `len`
    277.   #endif
    278.   
    279. > static int is_partially_overlapping(const void *ptr1, const void *ptr2,
    280.                                       int len)
    281.   {

crypto/evp/evp_enc.c:289:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_EncryptUpdate` 
    287.        */
    288.       int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
    289.                                                   (diff > (0 - (PTRDIFF_T)len)));
                                                            ^
    290.       assert(!overlapped);
    291.       return overlapped;

static int is_partially_overlapping(const void *ptr1, const void *ptr2,
                                    int len)
{
    PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;
    int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
                                                (diff > (0 - (PTRDIFF_T)len)));
    assert(!overlapped);
    return overlapped;
}
['static int kek_wrap_key(unsigned char *out, size_t *outlen,\n                        const unsigned char *in, size_t inlen,\n                        EVP_CIPHER_CTX *ctx)\n{\n    size_t blocklen = EVP_CIPHER_CTX_block_size(ctx);\n    size_t olen;\n    int dummy;\n    olen = (inlen + 4 + blocklen - 1) / blocklen;\n    olen *= blocklen;\n    if (olen < 2 * blocklen) {\n        return 0;\n    }\n    if (inlen > 0xFF) {\n        return 0;\n    }\n    if (out) {\n        out[0] = (unsigned char)inlen;\n        out[1] = in[0] ^ 0xFF;\n        out[2] = in[1] ^ 0xFF;\n        out[3] = in[2] ^ 0xFF;\n        memcpy(out + 4, in, inlen);\n        if (olen > inlen + 4\n            && RAND_bytes(out + 4 + inlen, olen - 4 - inlen) <= 0)\n            return 0;\n        if (!EVP_EncryptUpdate(ctx, out, &dummy, out, olen)\n            || !EVP_EncryptUpdate(ctx, out, &dummy, out, olen))\n            return 0;\n    }\n    *outlen = olen;\n    return 1;\n}', 'int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,\n                      const unsigned char *in, int inl)\n{\n    int i, j, bl;\n    if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {\n        if (is_partially_overlapping(out, in, inl)) {\n            EVPerr(EVP_F_EVP_ENCRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);\n            return 0;\n        }\n        i = ctx->cipher->do_cipher(ctx, out, in, inl);\n        if (i < 0)\n            return 0;\n        else\n            *outl = i;\n        return 1;\n    }\n    if (inl <= 0) {\n        *outl = 0;\n        return inl == 0;\n    }\n    if (is_partially_overlapping(out, in, inl)) {\n        EVPerr(EVP_F_EVP_ENCRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);\n        return 0;\n    }\n    if (ctx->buf_len == 0 && (inl & (ctx->block_mask)) == 0) {\n        if (ctx->cipher->do_cipher(ctx, out, in, inl)) {\n            *outl = inl;\n            return 1;\n        } else {\n            *outl = 0;\n            return 0;\n        }\n    }\n    i = ctx->buf_len;\n    bl = ctx->cipher->block_size;\n    OPENSSL_assert(bl <= (int)sizeof(ctx->buf));\n    if (i != 0) {\n        if (bl - i > inl) {\n            memcpy(&(ctx->buf[i]), in, inl);\n            ctx->buf_len += inl;\n            *outl = 0;\n            return 1;\n        } else {\n            j = bl - i;\n            memcpy(&(ctx->buf[i]), in, j);\n            inl -= j;\n            in += j;\n            if (is_partially_overlapping(out, in, bl)) {\n\t        EVPerr(EVP_F_EVP_ENCRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);\n                return 0;\n            }\n            if (!ctx->cipher->do_cipher(ctx, out, ctx->buf, bl))\n                return 0;\n            out += bl;\n            *outl = bl;\n        }\n    } else\n        *outl = 0;\n    i = inl & (bl - 1);\n    inl -= i;\n    if (inl > 0) {\n        if (!ctx->cipher->do_cipher(ctx, out, in, inl))\n            return 0;\n        *outl += inl;\n    }\n    if (i != 0)\n        memcpy(ctx->buf, &(in[inl]), i);\n    ctx->buf_len = i;\n    return 1;\n}', 'static int is_partially_overlapping(const void *ptr1, const void *ptr2,\n                                    int len)\n{\n    PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;\n    int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |\n                                                (diff > (0 - (PTRDIFF_T)len)));\n    assert(!overlapped);\n    return overlapped;\n}']