crypto/evp/bio_enc.c:194: error: INTEGER_OVERFLOW_L1
  (0 - [1, 256]):unsigned64 by call to `EVP_CipherUpdate`.
Showing all 9 steps of the trace


crypto/evp/bio_enc.c:193:17: Assignment
191.               }
192.               if (i > ENC_MIN_CHUNK)
193.                   i = ENC_MIN_CHUNK;
                       ^
194.               if (!EVP_CipherUpdate(ctx->cipher,
195.                                     ctx->buf, &ctx->buf_len,

crypto/evp/bio_enc.c:194:18: Call
192.               if (i > ENC_MIN_CHUNK)
193.                   i = ENC_MIN_CHUNK;
194.               if (!EVP_CipherUpdate(ctx->cipher,
                        ^
195.                                     ctx->buf, &ctx->buf_len,
196.                                     ctx->read_start, i)) {

crypto/evp/evp_enc.c:205:1: Parameter `inl`
  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:209:16: Call
  207.   {
  208.       if (ctx->encrypt)
  209.           return EVP_EncryptUpdate(ctx, out, outl, in, inl);
                        ^
  210.       else
  211.           return EVP_DecryptUpdate(ctx, out, outl, in, inl);

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:300:13: Call
    298.   
    299.       if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
    300.           if (is_partially_overlapping(out, in, inl)) {
                       ^
    301.               EVPerr(EVP_F_EVP_ENCRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);
    302.               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 - [1, 256]):unsigned64 by call to `EVP_CipherUpdate` 
      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 enc_read(BIO *b, char *out, int outl)\n{\n    int ret = 0, i, blocksize;\n    BIO_ENC_CTX *ctx;\n    BIO *next;\n    if (out == NULL)\n        return (0);\n    ctx = BIO_get_data(b);\n    next = BIO_next(b);\n    if ((ctx == NULL) || (next == NULL))\n        return 0;\n    if (ctx->buf_len > 0) {\n        i = ctx->buf_len - ctx->buf_off;\n        if (i > outl)\n            i = outl;\n        memcpy(out, &(ctx->buf[ctx->buf_off]), i);\n        ret = i;\n        out += i;\n        outl -= i;\n        ctx->buf_off += i;\n        if (ctx->buf_len == ctx->buf_off) {\n            ctx->buf_len = 0;\n            ctx->buf_off = 0;\n        }\n    }\n    blocksize = EVP_CIPHER_CTX_block_size(ctx->cipher);\n    if (blocksize == 1)\n        blocksize = 0;\n    while (outl > 0) {\n        if (ctx->cont <= 0)\n            break;\n        if (ctx->read_start == ctx->read_end) {\n            ctx->read_end = ctx->read_start = &(ctx->buf[BUF_OFFSET]);\n            ctx->read_end += BIO_read(next, ctx->read_start, ENC_BLOCK_SIZE);\n        }\n        i = ctx->read_end - ctx->read_start;\n        if (i <= 0) {\n            if (!BIO_should_retry(next)) {\n                ctx->cont = i;\n                i = EVP_CipherFinal_ex(ctx->cipher,\n                                       ctx->buf, &(ctx->buf_len));\n                ctx->ok = i;\n                ctx->buf_off = 0;\n            } else {\n                ret = (ret == 0) ? i : ret;\n                break;\n            }\n        } else {\n            if (outl > ENC_MIN_CHUNK) {\n                int j = outl - blocksize, buf_len;\n                if (!EVP_CipherUpdate(ctx->cipher,\n                                      (unsigned char *)out, &buf_len,\n                                      ctx->read_start, i > j ? j : i)) {\n                    BIO_clear_retry_flags(b);\n                    return 0;\n                }\n                ret += buf_len;\n                out += buf_len;\n                outl -= buf_len;\n                if ((i -= j) <= 0) {\n                    ctx->read_start = ctx->read_end;\n                    continue;\n                }\n                ctx->read_start += j;\n            }\n            if (i > ENC_MIN_CHUNK)\n                i = ENC_MIN_CHUNK;\n            if (!EVP_CipherUpdate(ctx->cipher,\n                                  ctx->buf, &ctx->buf_len,\n                                  ctx->read_start, i)) {\n                BIO_clear_retry_flags(b);\n                ctx->ok = 0;\n                return 0;\n            }\n            ctx->read_start += i;\n            ctx->cont = 1;\n            if (ctx->buf_len == 0)\n                continue;\n        }\n        if (ctx->buf_len <= outl)\n            i = ctx->buf_len;\n        else\n            i = outl;\n        if (i <= 0)\n            break;\n        memcpy(out, ctx->buf, i);\n        ret += i;\n        ctx->buf_off = i;\n        outl -= i;\n        out += i;\n    }\n    BIO_clear_retry_flags(b);\n    BIO_copy_next_retry(b);\n    return ((ret == 0) ? ctx->cont : 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_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}']