test/evp_extra_test.c:1246: error: INTEGER_OVERFLOW_L2
  (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate`.
Showing all 10 steps of the trace


test/evp_extra_test.c:1232:1: Parameter `cipher->block_size`
1230.   }
1231.   
1232. > static int encrypt_decrypt(const EVP_CIPHER *cipher, const unsigned char *msg,
1233.                              size_t len)
1234.   {

test/evp_extra_test.c:1246:17: Call
1244.               || !TEST_true(EVP_CipherFinal_ex(ctx, ct, &ctlen))
1245.               || !TEST_true(EVP_CipherInit_ex(ctx, cipher, NULL, key, NULL, 0))
1246.               || !TEST_true(EVP_CipherUpdate(ctx, pt, &ptlen, ct, ctlen))
                        ^
1247.               || !TEST_true(EVP_CipherFinal_ex(ctx, pt, &ptlen))
1248.               || !TEST_mem_eq(pt, ptlen, msg, len))

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

crypto/evp/evp_enc.c:420:16: Call
  418.           return EVP_EncryptUpdate(ctx, out, outl, in, inl);
  419.       else
  420.           return EVP_DecryptUpdate(ctx, out, outl, in, inl);
                        ^
  421.   }
  422.   

crypto/evp/evp_enc.c:715:1: Parameter `ctx->cipher->block_size`
    713.   }
    714.   
    715. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
    716.                         const unsigned char *in, int inl)
    717.   {

crypto/evp/evp_enc.c:759:5: Assignment
    757.    legacy:
    758.   
    759.       b = ctx->cipher->block_size;
               ^
    760.   
    761.       if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS))

crypto/evp/evp_enc.c:792:16: Call
    790.           /* see comment about PTRDIFF_T comparison above */
    791.           if (((PTRDIFF_T)out == (PTRDIFF_T)in)
    792.               || is_partially_overlapping(out, in, b)) {
                          ^
    793.               EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);
    794.               return 0;

crypto/evp/evp_enc.c:488:1: <RHS trace>
486.   #endif
487.   
488. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
489.   {
490.       PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;

crypto/evp/evp_enc.c:488:1: Parameter `len`
      486.   #endif
      487.   
      488. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
      489.   {
      490.       PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;

crypto/evp/evp_enc.c:497:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate` 
      495.        */
      496.       int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
      497.                                                   (diff > (0 - (PTRDIFF_T)len)));
                                                              ^
      498.   
      499.       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 encrypt_decrypt(const EVP_CIPHER *cipher, const unsigned char *msg,\n                           size_t len)\n{\n    int ret = 0, ctlen, ptlen;\n    EVP_CIPHER_CTX *ctx = NULL;\n    unsigned char key[128 / 8];\n    unsigned char ct[64], pt[64];\n    memset(key, 0, sizeof(key));\n    if (!TEST_ptr(ctx = EVP_CIPHER_CTX_new())\n            || !TEST_true(EVP_CipherInit_ex(ctx, cipher, NULL, key, NULL, 1))\n            || !TEST_true(EVP_CipherUpdate(ctx, ct, &ctlen, msg, len))\n            || !TEST_true(EVP_CipherFinal_ex(ctx, ct, &ctlen))\n            || !TEST_true(EVP_CipherInit_ex(ctx, cipher, NULL, key, NULL, 0))\n            || !TEST_true(EVP_CipherUpdate(ctx, pt, &ptlen, ct, ctlen))\n            || !TEST_true(EVP_CipherFinal_ex(ctx, pt, &ptlen))\n            || !TEST_mem_eq(pt, ptlen, msg, len))\n        goto err;\n    ret = 1;\n err:\n    EVP_CIPHER_CTX_free(ctx);\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, ret;\n    unsigned int b;\n    size_t soutl;\n    int blocksize;\n    if (ctx->encrypt) {\n        EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_INVALID_OPERATION);\n        return 0;\n    }\n    if (ctx->cipher == NULL) {\n        EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_NO_CIPHER_SET);\n        return 0;\n    }\n    if (ctx->cipher->prov == NULL)\n        goto legacy;\n    blocksize = EVP_CIPHER_CTX_block_size(ctx);\n    if (ctx->cipher->cupdate == NULL || blocksize < 1) {\n        EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_UPDATE_ERROR);\n        return 0;\n    }\n    ret = ctx->cipher->cupdate(ctx->provctx, out, &soutl,\n                               inl + (blocksize == 1 ? 0 : blocksize), in,\n                               (size_t)inl);\n    if (ret) {\n        if (soutl > INT_MAX) {\n            EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_UPDATE_ERROR);\n            return 0;\n        }\n        *outl = soutl;\n    }\n    return ret;\n legacy:\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_EncryptDecryptUpdate(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_EncryptDecryptUpdate(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}']