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


crypto/evp/bio_enc.c:270:14: Call
268.       while (inl > 0) {
269.           n = (inl > ENC_BLOCK_SIZE) ? ENC_BLOCK_SIZE : inl;
270.           if (!EVP_CipherUpdate(ctx->cipher,
                    ^
271.                                 ctx->buf, &ctx->buf_len,
272.                                 (const unsigned char *)in, n)) {

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

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

crypto/evp/evp_enc.c:421:1: Parameter `ctx->cipher->block_size`
    419.   }
    420.   
    421. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
    422.                         const unsigned char *in, int inl)
    423.   {

crypto/evp/evp_enc.c:427:5: Assignment
    425.       unsigned int b;
    426.   
    427.       b = ctx->cipher->block_size;
               ^
    428.   
    429.       if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS))

crypto/evp/evp_enc.c:460:16: Call
    458.           /* see comment about PTRDIFF_T comparison above */
    459.           if (((PTRDIFF_T)out == (PTRDIFF_T)in)
    460.               || is_partially_overlapping(out, in, b)) {
                          ^
    461.               EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);
    462.               return 0;

crypto/evp/evp_enc.c:281:1: <RHS trace>
279.   #endif
280.   
281. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
282.   {
283.       PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;

crypto/evp/evp_enc.c:281:1: Parameter `len`
      279.   #endif
      280.   
      281. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
      282.   {
      283.       PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;

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

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)));
    return overlapped;
}
['static int enc_write(BIO *b, const char *in, int inl)\n{\n    int ret = 0, n, i;\n    BIO_ENC_CTX *ctx;\n    BIO *next;\n    ctx = BIO_get_data(b);\n    next = BIO_next(b);\n    if ((ctx == NULL) || (next == NULL))\n        return 0;\n    ret = inl;\n    BIO_clear_retry_flags(b);\n    n = ctx->buf_len - ctx->buf_off;\n    while (n > 0) {\n        i = BIO_write(next, &(ctx->buf[ctx->buf_off]), n);\n        if (i <= 0) {\n            BIO_copy_next_retry(b);\n            return (i);\n        }\n        ctx->buf_off += i;\n        n -= i;\n    }\n    if ((in == NULL) || (inl <= 0))\n        return (0);\n    ctx->buf_off = 0;\n    while (inl > 0) {\n        n = (inl > ENC_BLOCK_SIZE) ? ENC_BLOCK_SIZE : inl;\n        if (!EVP_CipherUpdate(ctx->cipher,\n                              ctx->buf, &ctx->buf_len,\n                              (const unsigned char *)in, n)) {\n            BIO_clear_retry_flags(b);\n            ctx->ok = 0;\n            return 0;\n        }\n        inl -= n;\n        in += n;\n        ctx->buf_off = 0;\n        n = ctx->buf_len;\n        while (n > 0) {\n            i = BIO_write(next, &(ctx->buf[ctx->buf_off]), n);\n            if (i <= 0) {\n                BIO_copy_next_retry(b);\n                return (ret == inl) ? i : ret - inl;\n            }\n            n -= i;\n            ctx->buf_off += i;\n        }\n        ctx->buf_len = 0;\n        ctx->buf_off = 0;\n    }\n    BIO_copy_next_retry(b);\n    return (ret);\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, cmpl = inl;\n    unsigned int b;\n    b = ctx->cipher->block_size;\n    if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS))\n        cmpl = (cmpl + 7) / 8;\n    if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {\n        if (b == 1 && is_partially_overlapping(out, in, cmpl)) {\n            EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);\n            return 0;\n        }\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    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            EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);\n            return 0;\n        }\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}', 'int is_partially_overlapping(const void *ptr1, const void *ptr2, 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    return overlapped;\n}']