crypto/evp/bio_enc.c:150: error: BUFFER_OVERRUN_L1
  Offset: 288 Size: 32.
Showing all 4 steps of the trace


crypto/evp/bio_enc.c:162:21: <Length trace>
160.               if (!BIO_should_retry(next)) {
161.                   ctx->cont = i;
162.                   i = EVP_CipherFinal_ex(ctx->cipher,
                           ^
163.                                          ctx->buf, &(ctx->buf_len));
164.                   ctx->ok = i;

crypto/evp/bio_enc.c:162:21: Call
160.               if (!BIO_should_retry(next)) {
161.                   ctx->cont = i;
162.                   i = EVP_CipherFinal_ex(ctx->cipher,
                           ^
163.                                          ctx->buf, &(ctx->buf_len));
164.                   ctx->ok = i;

crypto/evp/evp_enc.c:214:1: Parameter `*out`
  212.   }
  213.   
  214. > int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
  215.   {
  216.       if (ctx->encrypt)

crypto/evp/bio_enc.c:150:29: Array access: Offset: 288 Size: 32
148.   
149.           if (ctx->read_start == ctx->read_end) { /* time to read more data */
150.               ctx->read_end = ctx->read_start = &(ctx->buf[BUF_OFFSET]);
                                   ^
151.               i = BIO_read(next, ctx->read_start, ENC_BLOCK_SIZE);
152.               if (i > 0)

static int enc_read(BIO *b, char *out, int outl)
{
    int ret = 0, i, blocksize;
    BIO_ENC_CTX *ctx;
    BIO *next;
    if (out == NULL)
        return (0);
    ctx = BIO_get_data(b);
    next = BIO_next(b);
    if ((ctx == NULL) || (next == NULL))
        return 0;
    if (ctx->buf_len > 0) {
        i = ctx->buf_len - ctx->buf_off;
        if (i > outl)
            i = outl;
        memcpy(out, &(ctx->buf[ctx->buf_off]), i);
        ret = i;
        out += i;
        outl -= i;
        ctx->buf_off += i;
        if (ctx->buf_len == ctx->buf_off) {
            ctx->buf_len = 0;
            ctx->buf_off = 0;
        }
    }
    blocksize = EVP_CIPHER_CTX_block_size(ctx->cipher);
    if (blocksize == 1)
        blocksize = 0;
    while (outl > 0) {
        if (ctx->cont <= 0)
            break;
        if (ctx->read_start == ctx->read_end) {
            ctx->read_end = ctx->read_start = &(ctx->buf[BUF_OFFSET]);
            i = BIO_read(next, ctx->read_start, ENC_BLOCK_SIZE);
            if (i > 0)
                ctx->read_end += i;
        } else {
            i = ctx->read_end - ctx->read_start;
        }
        if (i <= 0) {
            if (!BIO_should_retry(next)) {
                ctx->cont = i;
                i = EVP_CipherFinal_ex(ctx->cipher,
                                       ctx->buf, &(ctx->buf_len));
                ctx->ok = i;
                ctx->buf_off = 0;
            } else {
                ret = (ret == 0) ? i : ret;
                break;
            }
        } else {
            if (outl > ENC_MIN_CHUNK) {
                int j = outl - blocksize, buf_len;
                if (!EVP_CipherUpdate(ctx->cipher,
                                      (unsigned char *)out, &buf_len,
                                      ctx->read_start, i > j ? j : i)) {
                    BIO_clear_retry_flags(b);
                    return 0;
                }
                ret += buf_len;
                out += buf_len;
                outl -= buf_len;
                if ((i -= j) <= 0) {
                    ctx->read_start = ctx->read_end;
                    continue;
                }
                ctx->read_start += j;
            }
            if (i > ENC_MIN_CHUNK)
                i = ENC_MIN_CHUNK;
            if (!EVP_CipherUpdate(ctx->cipher,
                                  ctx->buf, &ctx->buf_len,
                                  ctx->read_start, i)) {
                BIO_clear_retry_flags(b);
                ctx->ok = 0;
                return 0;
            }
            ctx->read_start += i;
            ctx->cont = 1;
            if (ctx->buf_len == 0)
                continue;
        }
        if (ctx->buf_len <= outl)
            i = ctx->buf_len;
        else
            i = outl;
        if (i <= 0)
            break;
        memcpy(out, ctx->buf, i);
        ret += i;
        ctx->buf_off = i;
        outl -= i;
        out += i;
    }
    BIO_clear_retry_flags(b);
    BIO_copy_next_retry(b);
    return ((ret == 0) ? ctx->cont : ret);
}
['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            i = BIO_read(next, ctx->read_start, ENC_BLOCK_SIZE);\n            if (i > 0)\n                ctx->read_end += i;\n        } else {\n            i = ctx->read_end - ctx->read_start;\n        }\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_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)\n{\n    if (ctx->encrypt)\n        return EVP_EncryptFinal_ex(ctx, out, outl);\n    else\n        return EVP_DecryptFinal_ex(ctx, out, outl);\n}']