crypto/evp/e_aria.c:599: error: BUFFER_OVERRUN_L3
  Offset added: [2, 16] Size: [0, +oo] by call to `CRYPTO_ccm128_tag`.
Showing all 7 steps of the trace


crypto/evp/e_aria.c:527:1: Parameter `arg`
525.   }
526.   
527. > static int aria_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
528.   {
529.       EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX,c);

crypto/evp/e_aria.c:599:14: Call
597.           if (!EVP_CIPHER_CTX_encrypting(c) || !cctx->tag_set)
598.               return 0;
599.           if (!CRYPTO_ccm128_tag(&cctx->ccm, ptr, (size_t)arg))
                    ^
600.               return 0;
601.           cctx->tag_set = 0;

crypto/modes/ccm128.c:422:1: <Offset trace>
420.   }
421.   
422. > size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
423.   {
424.       unsigned int M = (ctx->nonce.c[0] >> 3) & 7; /* the M parameter */

crypto/modes/ccm128.c:422:1: Parameter `len`
  420.   }
  421.   
  422. > size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
  423.   {
  424.       unsigned int M = (ctx->nonce.c[0] >> 3) & 7; /* the M parameter */

crypto/modes/ccm128.c:422:1: <Length trace>
420.   }
421.   
422. > size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
423.   {
424.       unsigned int M = (ctx->nonce.c[0] >> 3) & 7; /* the M parameter */

crypto/modes/ccm128.c:422:1: Parameter `ctx->cmac.c[*]`
  420.   }
  421.   
  422. > size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
  423.   {
  424.       unsigned int M = (ctx->nonce.c[0] >> 3) & 7; /* the M parameter */

crypto/modes/ccm128.c:430:5: Array access: Offset added: [2, 16] Size: [0, +oo] by call to `CRYPTO_ccm128_tag` 
  428.       if (len < M)
  429.           return 0;
  430.       memcpy(tag, ctx->cmac.c, M);
             ^
  431.       return M;
  432.   }

size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
{
    unsigned int M = (ctx->nonce.c[0] >> 3) & 7;
    M *= 2;
    M += 2;
    if (len < M)
        return 0;
    memcpy(tag, ctx->cmac.c, M);
    return M;
}
['static int aria_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)\n{\n    EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX,c);\n    switch (type) {\n    case EVP_CTRL_INIT:\n        cctx->key_set = 0;\n        cctx->iv_set = 0;\n        cctx->L = 8;\n        cctx->M = 12;\n        cctx->tag_set = 0;\n        cctx->len_set = 0;\n        cctx->tls_aad_len = -1;\n        return 1;\n    case EVP_CTRL_AEAD_TLS1_AAD:\n        if (arg != EVP_AEAD_TLS1_AAD_LEN)\n            return 0;\n        memcpy(EVP_CIPHER_CTX_buf_noconst(c), ptr, arg);\n        cctx->tls_aad_len = arg;\n        {\n            uint16_t len =\n                EVP_CIPHER_CTX_buf_noconst(c)[arg - 2] << 8\n                | EVP_CIPHER_CTX_buf_noconst(c)[arg - 1];\n            if (len < EVP_CCM_TLS_EXPLICIT_IV_LEN)\n                return 0;\n            len -= EVP_CCM_TLS_EXPLICIT_IV_LEN;\n            if (!EVP_CIPHER_CTX_encrypting(c)) {\n                if (len < cctx->M)\n                    return 0;\n                len -= cctx->M;\n            }\n            EVP_CIPHER_CTX_buf_noconst(c)[arg - 2] = len >> 8;\n            EVP_CIPHER_CTX_buf_noconst(c)[arg - 1] = len & 0xff;\n        }\n        return cctx->M;\n    case EVP_CTRL_CCM_SET_IV_FIXED:\n        if (arg != EVP_CCM_TLS_FIXED_IV_LEN)\n            return 0;\n        memcpy(EVP_CIPHER_CTX_iv_noconst(c), ptr, arg);\n        return 1;\n    case EVP_CTRL_AEAD_SET_IVLEN:\n        arg = 15 - arg;\n    case EVP_CTRL_CCM_SET_L:\n        if (arg < 2 || arg > 8)\n            return 0;\n        cctx->L = arg;\n        return 1;\n    case EVP_CTRL_AEAD_SET_TAG:\n        if ((arg & 1) || arg < 4 || arg > 16)\n            return 0;\n        if (EVP_CIPHER_CTX_encrypting(c) && ptr)\n            return 0;\n        if (ptr) {\n            cctx->tag_set = 1;\n            memcpy(EVP_CIPHER_CTX_buf_noconst(c), ptr, arg);\n        }\n        cctx->M = arg;\n        return 1;\n    case EVP_CTRL_AEAD_GET_TAG:\n        if (!EVP_CIPHER_CTX_encrypting(c) || !cctx->tag_set)\n            return 0;\n        if (!CRYPTO_ccm128_tag(&cctx->ccm, ptr, (size_t)arg))\n            return 0;\n        cctx->tag_set = 0;\n        cctx->iv_set = 0;\n        cctx->len_set = 0;\n        return 1;\n    case EVP_CTRL_COPY:\n        {\n            EVP_CIPHER_CTX *out = ptr;\n            EVP_ARIA_CCM_CTX *cctx_out = EVP_C_DATA(EVP_ARIA_CCM_CTX,out);\n            if (cctx->ccm.key) {\n                if (cctx->ccm.key != &cctx->ks)\n                    return 0;\n                cctx_out->ccm.key = &cctx_out->ks;\n            }\n            return 1;\n        }\n    default:\n        return -1;\n    }\n}', 'size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len)\n{\n    unsigned int M = (ctx->nonce.c[0] >> 3) & 7;\n    M *= 2;\n    M += 2;\n    if (len < M)\n        return 0;\n    memcpy(tag, ctx->cmac.c, M);\n    return M;\n}']