crypto/evp/e_chacha20_poly1305.c:186: error: BUFFER_OVERRUN_L2
  Offset: [3, 18] (⇐ [0, 15] + 3) Size: 16 by call to `chacha_init_key`.
Showing all 5 steps of the trace


crypto/evp/e_chacha20_poly1305.c:163:1: Array declaration
161.   #  define POLY1305_ctx(actx)    ((POLY1305 *)(actx + 1))
162.   
163. > static int chacha20_poly1305_init_key(EVP_CIPHER_CTX *ctx,
164.                                         const unsigned char *inkey,
165.                                         const unsigned char *iv, int enc)

crypto/evp/e_chacha20_poly1305.c:186:9: Call
184.                      actx->nonce_len);
185.   
186.           chacha_init_key(ctx, inkey, temp, enc);
               ^
187.   
188.           actx->nonce[0] = actx->key.counter[1];

crypto/evp/e_chacha20_poly1305.c:33:1: <Length trace>
31.   #define data(ctx)   ((EVP_CHACHA_KEY *)(ctx)->cipher_data)
32.   
33. > static int chacha_init_key(EVP_CIPHER_CTX *ctx,
34.                              const unsigned char user_key[CHACHA_KEY_SIZE],
35.                              const unsigned char iv[CHACHA_CTR_SIZE], int enc)

crypto/evp/e_chacha20_poly1305.c:33:1: Parameter `*iv`
  31.   #define data(ctx)   ((EVP_CHACHA_KEY *)(ctx)->cipher_data)
  32.   
  33. > static int chacha_init_key(EVP_CIPHER_CTX *ctx,
  34.                              const unsigned char user_key[CHACHA_KEY_SIZE],
  35.                              const unsigned char iv[CHACHA_CTR_SIZE], int enc)

crypto/evp/e_chacha20_poly1305.c:47:33: Array access: Offset: [3, 18] (⇐ [0, 15] + 3) Size: 16 by call to `chacha_init_key` 
  45.       if (iv)
  46.           for (i = 0; i < CHACHA_CTR_SIZE; i+=4) {
  47.               key->counter[i/4] = CHACHA_U8TOU32(iv+i);
                                        ^
  48.           }
  49.   

static int chacha_init_key(EVP_CIPHER_CTX *ctx,
                           const unsigned char user_key[CHACHA_KEY_SIZE],
                           const unsigned char iv[CHACHA_CTR_SIZE], int enc)
{
    EVP_CHACHA_KEY *key = data(ctx);
    unsigned int i;
    if (user_key)
        for (i = 0; i < CHACHA_KEY_SIZE; i+=4) {
            key->key.d[i/4] = CHACHA_U8TOU32(user_key+i);
        }
    if (iv)
        for (i = 0; i < CHACHA_CTR_SIZE; i+=4) {
            key->counter[i/4] = CHACHA_U8TOU32(iv+i);
        }
    key->partial_len = 0;
    return 1;
}
['static int chacha20_poly1305_init_key(EVP_CIPHER_CTX *ctx,\n                                      const unsigned char *inkey,\n                                      const unsigned char *iv, int enc)\n{\n    EVP_CHACHA_AEAD_CTX *actx = aead_data(ctx);\n    if (!inkey && !iv)\n        return 1;\n    actx->len.aad = 0;\n    actx->len.text = 0;\n    actx->aad = 0;\n    actx->mac_inited = 0;\n    actx->tls_payload_length = NO_TLS_PAYLOAD_LENGTH;\n    if (iv != NULL) {\n        unsigned char temp[CHACHA_CTR_SIZE] = { 0 };\n        if (actx->nonce_len <= CHACHA_CTR_SIZE)\n            memcpy(temp + CHACHA_CTR_SIZE - actx->nonce_len, iv,\n                   actx->nonce_len);\n        chacha_init_key(ctx, inkey, temp, enc);\n        actx->nonce[0] = actx->key.counter[1];\n        actx->nonce[1] = actx->key.counter[2];\n        actx->nonce[2] = actx->key.counter[3];\n    } else {\n        chacha_init_key(ctx, inkey, NULL, enc);\n    }\n    return 1;\n}', 'static int chacha_init_key(EVP_CIPHER_CTX *ctx,\n                           const unsigned char user_key[CHACHA_KEY_SIZE],\n                           const unsigned char iv[CHACHA_CTR_SIZE], int enc)\n{\n    EVP_CHACHA_KEY *key = data(ctx);\n    unsigned int i;\n    if (user_key)\n        for (i = 0; i < CHACHA_KEY_SIZE; i+=4) {\n            key->key.d[i/4] = CHACHA_U8TOU32(user_key+i);\n        }\n    if (iv)\n        for (i = 0; i < CHACHA_CTR_SIZE; i+=4) {\n            key->counter[i/4] = CHACHA_U8TOU32(iv+i);\n        }\n    key->partial_len = 0;\n    return 1;\n}']