crypto/pkcs12/p12_decr.c:51: error: INTEGER_OVERFLOW_L2
  (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate`.
Showing all 8 steps of the trace


crypto/pkcs12/p12_decr.c:51:10: Call
49.       }
50.   
51.       if (!EVP_CipherUpdate(ctx, out, &i, in, inlen)) {
               ^
52.           OPENSSL_free(out);
53.           out = NULL;

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: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:341:17: Call
    339.               inl -= j;
    340.               in += j;
    341.               if (is_partially_overlapping(out, in, bl))
                           ^
    342.                   return 0;
    343.               if (!ctx->cipher->do_cipher(ctx, out, ctx->buf, bl))

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;
}
['unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass,\n                                int passlen, unsigned char *in, int inlen,\n                                unsigned char **data, int *datalen, int en_de)\n{\n    unsigned char *out = NULL;\n    int outlen, i;\n    EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();\n    if (ctx == NULL) {\n        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    if (!EVP_PBE_CipherInit(algor->algorithm, pass, passlen,\n                            algor->parameter, ctx, en_de)) {\n        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,\n                  PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR);\n        goto err;\n    }\n    if ((out = OPENSSL_malloc(inlen + EVP_CIPHER_CTX_block_size(ctx)))\n            == NULL) {\n        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    if (!EVP_CipherUpdate(ctx, out, &i, in, inlen)) {\n        OPENSSL_free(out);\n        out = NULL;\n        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT, ERR_R_EVP_LIB);\n        goto err;\n    }\n    outlen = i;\n    if (!EVP_CipherFinal_ex(ctx, out + i, &i)) {\n        OPENSSL_free(out);\n        out = NULL;\n        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,\n                  PKCS12_R_PKCS12_CIPHERFINAL_ERROR);\n        goto err;\n    }\n    outlen += i;\n    if (datalen)\n        *datalen = outlen;\n    if (data)\n        *data = out;\n err:\n    EVP_CIPHER_CTX_free(ctx);\n    return out;\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            return 0;\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        return 0;\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                return 0;\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 condition = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |\n                                               (diff > (0 - (PTRDIFF_T)len)));\n    assert(!condition);\n    return condition;\n}']