providers/common/ciphers/aes.c:130: error: INTEGER_OVERFLOW_L2
  ([1, +oo] - 16):unsigned64.
Showing all 4 steps of the trace


providers/common/ciphers/aes.c:101:25: <LHS trace>
99.   {
100.       PROV_AES_KEY *ctx = (PROV_AES_KEY *)vctx;
101.       size_t nextblocks = fillblock(ctx->buf, &ctx->bufsz, AES_BLOCK_SIZE, &in,
                               ^
102.                                     &inl);
103.       size_t outlint = 0;

providers/common/ciphers/aes.c:101:25: Call
99.   {
100.       PROV_AES_KEY *ctx = (PROV_AES_KEY *)vctx;
101.       size_t nextblocks = fillblock(ctx->buf, &ctx->bufsz, AES_BLOCK_SIZE, &in,
                               ^
102.                                     &inl);
103.       size_t outlint = 0;

providers/common/ciphers/block.c:37:1: Parameter `blocksize`
  35.    * which is a multiple of the blocksize.
  36.    */
  37. > size_t fillblock(unsigned char *buf, size_t *buflen, size_t blocksize,
  38.                    const unsigned char **in, size_t *inlen)
  39.   {

providers/common/ciphers/aes.c:130:13: Binary operation: ([1, +oo] - 16):unsigned64
128.                   return 0;
129.               }
130.               nextblocks -= AES_BLOCK_SIZE;
                   ^
131.           }
132.           outlint += nextblocks;

static int aes_block_update(void *vctx, unsigned char *out, size_t *outl,
                            size_t outsize, const unsigned char *in, size_t inl)
{
    PROV_AES_KEY *ctx = (PROV_AES_KEY *)vctx;
    size_t nextblocks = fillblock(ctx->buf, &ctx->bufsz, AES_BLOCK_SIZE, &in,
                                  &inl);
    size_t outlint = 0;
    if (ctx->bufsz == AES_BLOCK_SIZE
            && (ctx->enc || inl > 0 || !ctx->pad)) {
        if (outsize < AES_BLOCK_SIZE) {
            PROVerr(PROV_F_AES_BLOCK_UPDATE, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
            return 0;
        }
        if (!ctx->ciph->cipher(ctx, out, ctx->buf, AES_BLOCK_SIZE)) {
            PROVerr(PROV_F_AES_BLOCK_UPDATE, PROV_R_CIPHER_OPERATION_FAILED);
            return 0;
        }
        ctx->bufsz = 0;
        outlint = AES_BLOCK_SIZE;
        out += AES_BLOCK_SIZE;
    }
    if (nextblocks > 0) {
        if (!ctx->enc && ctx->pad && nextblocks == inl) {
            if (!ossl_assert(inl >= AES_BLOCK_SIZE)) {
                PROVerr(PROV_F_AES_BLOCK_UPDATE, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
                return 0;
            }
            nextblocks -= AES_BLOCK_SIZE;
        }
        outlint += nextblocks;
        if (outsize < outlint) {
            PROVerr(PROV_F_AES_BLOCK_UPDATE, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
            return 0;
        }
        if (!ctx->ciph->cipher(ctx, out, in, nextblocks)) {
            PROVerr(PROV_F_AES_BLOCK_UPDATE, PROV_R_CIPHER_OPERATION_FAILED);
            return 0;
        }
        in += nextblocks;
        inl -= nextblocks;
    }
    if (!trailingdata(ctx->buf, &ctx->bufsz, AES_BLOCK_SIZE, &in, &inl)) {
        return 0;
    }
    *outl = outlint;
    return inl == 0;
}
['static int aes_block_update(void *vctx, unsigned char *out, size_t *outl,\n                            size_t outsize, const unsigned char *in, size_t inl)\n{\n    PROV_AES_KEY *ctx = (PROV_AES_KEY *)vctx;\n    size_t nextblocks = fillblock(ctx->buf, &ctx->bufsz, AES_BLOCK_SIZE, &in,\n                                  &inl);\n    size_t outlint = 0;\n    if (ctx->bufsz == AES_BLOCK_SIZE\n            && (ctx->enc || inl > 0 || !ctx->pad)) {\n        if (outsize < AES_BLOCK_SIZE) {\n            PROVerr(PROV_F_AES_BLOCK_UPDATE, PROV_R_OUTPUT_BUFFER_TOO_SMALL);\n            return 0;\n        }\n        if (!ctx->ciph->cipher(ctx, out, ctx->buf, AES_BLOCK_SIZE)) {\n            PROVerr(PROV_F_AES_BLOCK_UPDATE, PROV_R_CIPHER_OPERATION_FAILED);\n            return 0;\n        }\n        ctx->bufsz = 0;\n        outlint = AES_BLOCK_SIZE;\n        out += AES_BLOCK_SIZE;\n    }\n    if (nextblocks > 0) {\n        if (!ctx->enc && ctx->pad && nextblocks == inl) {\n            if (!ossl_assert(inl >= AES_BLOCK_SIZE)) {\n                PROVerr(PROV_F_AES_BLOCK_UPDATE, PROV_R_OUTPUT_BUFFER_TOO_SMALL);\n                return 0;\n            }\n            nextblocks -= AES_BLOCK_SIZE;\n        }\n        outlint += nextblocks;\n        if (outsize < outlint) {\n            PROVerr(PROV_F_AES_BLOCK_UPDATE, PROV_R_OUTPUT_BUFFER_TOO_SMALL);\n            return 0;\n        }\n        if (!ctx->ciph->cipher(ctx, out, in, nextblocks)) {\n            PROVerr(PROV_F_AES_BLOCK_UPDATE, PROV_R_CIPHER_OPERATION_FAILED);\n            return 0;\n        }\n        in += nextblocks;\n        inl -= nextblocks;\n    }\n    if (!trailingdata(ctx->buf, &ctx->bufsz, AES_BLOCK_SIZE, &in, &inl)) {\n        return 0;\n    }\n    *outl = outlint;\n    return inl == 0;\n}', 'size_t fillblock(unsigned char *buf, size_t *buflen, size_t blocksize,\n                 const unsigned char **in, size_t *inlen)\n{\n    size_t blockmask = ~(blocksize - 1);\n    assert(*buflen <= blocksize);\n    assert(blocksize > 0 && (blocksize & (blocksize - 1)) == 0);\n    if (*buflen != blocksize && (*buflen != 0 || *inlen < blocksize)) {\n        size_t bufremain = blocksize - *buflen;\n        if (*inlen < bufremain)\n            bufremain = *inlen;\n        memcpy(buf + *buflen, *in, bufremain);\n        *in += bufremain;\n        *inlen -= bufremain;\n        *buflen += bufremain;\n    }\n    return *inlen & blockmask;\n}']