crypto/cms/cms_kari.c:211: error: INTEGER_OVERFLOW_L2
  (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate`.
Showing all 9 steps of the trace


crypto/cms/cms_kari.c:211:10: Call
209.       if (out == NULL)
210.           goto err;
211.       if (!EVP_CipherUpdate(kari->ctx, out, &outlen, in, inlen))
                ^
212.           goto err;
213.       *pout = out;

crypto/evp/evp_enc.c:205:1: Parameter `ctx->cipher->block_size`
  203.   }
  204.   
  205. > int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
  206.                        const unsigned char *in, int inl)
  207.   {

crypto/evp/evp_enc.c:211:16: Call
  209.           return EVP_EncryptUpdate(ctx, out, outl, in, inl);
  210.       else
  211.           return EVP_DecryptUpdate(ctx, out, outl, in, inl);
                        ^
  212.   }
  213.   

crypto/evp/evp_enc.c:413:1: Parameter `ctx->cipher->block_size`
    411.   }
    412.   
    413. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
    414.                         const unsigned char *in, int inl)
    415.   {

crypto/evp/evp_enc.c:440:5: Assignment
    438.           return EVP_EncryptUpdate(ctx, out, outl, in, inl);
    439.   
    440.       b = ctx->cipher->block_size;
               ^
    441.       OPENSSL_assert(b <= sizeof ctx->final);
    442.   

crypto/evp/evp_enc.c:446:16: Call
    444.           /* see comment about PTRDIFF_T comparison above */
    445.           if (((PTRDIFF_T)out == (PTRDIFF_T)in)
    446.               || is_partially_overlapping(out, in, b))
                          ^
    447.               return 0;
    448.           memcpy(out, ctx->final, b);

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:49: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate` 
      287.        */
      288.       int condition = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
      289.                                                  (diff > (0 - (PTRDIFF_T)len)));
                                                             ^
      290.       assert(!condition);
      291.       return condition;

static int is_partially_overlapping(const void *ptr1, const void *ptr2,
                                    int len)
{
    PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;
    int condition = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
                                               (diff > (0 - (PTRDIFF_T)len)));
    assert(!condition);
    return condition;
}
['static int cms_kek_cipher(unsigned char **pout, size_t *poutlen,\n                          const unsigned char *in, size_t inlen,\n                          CMS_KeyAgreeRecipientInfo *kari, int enc)\n{\n    unsigned char kek[EVP_MAX_KEY_LENGTH];\n    size_t keklen;\n    int rv = 0;\n    unsigned char *out = NULL;\n    int outlen;\n    keklen = EVP_CIPHER_CTX_key_length(kari->ctx);\n    if (keklen > EVP_MAX_KEY_LENGTH)\n        return 0;\n    if (EVP_PKEY_derive(kari->pctx, kek, &keklen) <= 0)\n        goto err;\n    if (!EVP_CipherInit_ex(kari->ctx, NULL, NULL, kek, NULL, enc))\n        goto err;\n    if (!EVP_CipherUpdate(kari->ctx, NULL, &outlen, in, inlen))\n        goto err;\n    out = OPENSSL_malloc(outlen);\n    if (out == NULL)\n        goto err;\n    if (!EVP_CipherUpdate(kari->ctx, out, &outlen, in, inlen))\n        goto err;\n    *pout = out;\n    *poutlen = (size_t)outlen;\n    rv = 1;\n err:\n    OPENSSL_cleanse(kek, keklen);\n    if (!rv)\n        OPENSSL_free(out);\n    EVP_CIPHER_CTX_reset(kari->ctx);\n    EVP_PKEY_CTX_free(kari->pctx);\n    kari->pctx = NULL;\n    return rv;\n}', 'int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,\n                     const unsigned char *in, int inl)\n{\n    if (ctx->encrypt)\n        return EVP_EncryptUpdate(ctx, out, outl, in, inl);\n    else\n        return EVP_DecryptUpdate(ctx, out, outl, in, inl);\n}', 'int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,\n                      const unsigned char *in, int inl)\n{\n    int fix_len;\n    unsigned int b;\n    if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {\n        if (is_partially_overlapping(out, in, inl))\n            return 0;\n        fix_len = ctx->cipher->do_cipher(ctx, out, in, inl);\n        if (fix_len < 0) {\n            *outl = 0;\n            return 0;\n        } else\n            *outl = fix_len;\n        return 1;\n    }\n    if (inl <= 0) {\n        *outl = 0;\n        return inl == 0;\n    }\n    if (ctx->flags & EVP_CIPH_NO_PADDING)\n        return EVP_EncryptUpdate(ctx, out, outl, in, inl);\n    b = ctx->cipher->block_size;\n    OPENSSL_assert(b <= sizeof ctx->final);\n    if (ctx->final_used) {\n        if (((PTRDIFF_T)out == (PTRDIFF_T)in)\n            || is_partially_overlapping(out, in, b))\n            return 0;\n        memcpy(out, ctx->final, b);\n        out += b;\n        fix_len = 1;\n    } else\n        fix_len = 0;\n    if (!EVP_EncryptUpdate(ctx, out, outl, in, inl))\n        return 0;\n    if (b > 1 && !ctx->buf_len) {\n        *outl -= b;\n        ctx->final_used = 1;\n        memcpy(ctx->final, &out[*outl], b);\n    } else\n        ctx->final_used = 0;\n    if (fix_len)\n        *outl += b;\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 condition = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |\n                                               (diff > (0 - (PTRDIFF_T)len)));\n    assert(!condition);\n    return condition;\n}']