crypto/rsa/rsa_crpt.c:149: error: BUFFER_OVERRUN_L3
  Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_BLINDING_create_param`.
Showing all 11 steps of the trace


crypto/rsa/rsa_crpt.c:110:1: Parameter `rsa->e->d`
108.   }
109.   
110. > BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx)
111.   {
112.       BIGNUM *e;

crypto/rsa/rsa_crpt.c:149:15: Call
147.           BN_with_flags(n, rsa->n, BN_FLG_CONSTTIME);
148.   
149.           ret = BN_BLINDING_create_param(NULL, e, n, ctx, rsa->meth->bn_mod_exp,
                     ^
150.                                          rsa->_method_mod_n);
151.           /* We MUST free n before any further use of rsa->n */

crypto/bn/bn_blind.c:213:1: Parameter `*e->d`
  211.   }
  212.   
  213. > BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
  214.                                         const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
  215.                                         int (*bn_mod_exp) (BIGNUM *r,

crypto/bn/bn_blind.c:241:18: Call
  239.       if (e != NULL) {
  240.           BN_free(ret->e);
  241.           ret->e = BN_dup(e);
                          ^
  242.       }
  243.       if (ret->e == NULL)

crypto/bn/bn_lib.c:261:1: Parameter `*a->d`
    259.   }
    260.   
    261. > BIGNUM *BN_dup(const BIGNUM *a)
    262.   {
    263.       BIGNUM *t;

crypto/bn/bn_lib.c:272:10: Call
    270.       if (t == NULL)
    271.           return NULL;
    272.       if (!BN_copy(t, a)) {
                    ^
    273.           BN_free(t);
    274.           return NULL;

crypto/bn/bn_lib.c:280:1: <Offset trace>
278.   }
279.   
280. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
281.   {
282.       bn_check_top(b);

crypto/bn/bn_lib.c:280:1: Parameter `b->top`
      278.   }
      279.   
      280. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
      281.   {
      282.       bn_check_top(b);

crypto/bn/bn_lib.c:280:1: <Length trace>
278.   }
279.   
280. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
281.   {
282.       bn_check_top(b);

crypto/bn/bn_lib.c:280:1: Parameter `*b->d`
      278.   }
      279.   
      280. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
      281.   {
      282.       bn_check_top(b);

crypto/bn/bn_lib.c:290:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_BLINDING_create_param` 
      288.   
      289.       if (b->top > 0)
      290.           memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
                     ^
      291.   
      292.       a->neg = b->neg;

BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
{
    bn_check_top(b);
    if (a == b)
        return a;
    if (bn_wexpand(a, b->top) == NULL)
        return NULL;
    if (b->top > 0)
        memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
    a->neg = b->neg;
    a->top = b->top;
    a->flags |= b->flags & BN_FLG_FIXED_TOP;
    bn_check_top(a);
    return a;
}
['BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx)\n{\n    BIGNUM *e;\n    BN_CTX *ctx;\n    BN_BLINDING *ret = NULL;\n    if (in_ctx == NULL) {\n        if ((ctx = BN_CTX_new()) == NULL)\n            return 0;\n    } else {\n        ctx = in_ctx;\n    }\n    BN_CTX_start(ctx);\n    e = BN_CTX_get(ctx);\n    if (e == NULL) {\n        RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    if (rsa->e == NULL) {\n        e = rsa_get_public_exp(rsa->d, rsa->p, rsa->q, ctx);\n        if (e == NULL) {\n            RSAerr(RSA_F_RSA_SETUP_BLINDING, RSA_R_NO_PUBLIC_EXPONENT);\n            goto err;\n        }\n    } else {\n        e = rsa->e;\n    }\n    {\n        BIGNUM *n = BN_new();\n        if (n == NULL) {\n            RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_MALLOC_FAILURE);\n            goto err;\n        }\n        BN_with_flags(n, rsa->n, BN_FLG_CONSTTIME);\n        ret = BN_BLINDING_create_param(NULL, e, n, ctx, rsa->meth->bn_mod_exp,\n                                       rsa->_method_mod_n);\n        BN_free(n);\n    }\n    if (ret == NULL) {\n        RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_BN_LIB);\n        goto err;\n    }\n    BN_BLINDING_set_current_thread(ret);\n err:\n    BN_CTX_end(ctx);\n    if (ctx != in_ctx)\n        BN_CTX_free(ctx);\n    if (e != rsa->e)\n        BN_free(e);\n    return ret;\n}', 'BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,\n                                      const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,\n                                      int (*bn_mod_exp) (BIGNUM *r,\n                                                         const BIGNUM *a,\n                                                         const BIGNUM *p,\n                                                         const BIGNUM *m,\n                                                         BN_CTX *ctx,\n                                                         BN_MONT_CTX *m_ctx),\n                                      BN_MONT_CTX *m_ctx)\n{\n    int retry_counter = 32;\n    BN_BLINDING *ret = NULL;\n    if (b == NULL)\n        ret = BN_BLINDING_new(NULL, NULL, m);\n    else\n        ret = b;\n    if (ret == NULL)\n        goto err;\n    if (ret->A == NULL && (ret->A = BN_new()) == NULL)\n        goto err;\n    if (ret->Ai == NULL && (ret->Ai = BN_new()) == NULL)\n        goto err;\n    if (e != NULL) {\n        BN_free(ret->e);\n        ret->e = BN_dup(e);\n    }\n    if (ret->e == NULL)\n        goto err;\n    if (bn_mod_exp != NULL)\n        ret->bn_mod_exp = bn_mod_exp;\n    if (m_ctx != NULL)\n        ret->m_ctx = m_ctx;\n    do {\n        int rv;\n        if (!BN_priv_rand_range(ret->A, ret->mod))\n            goto err;\n        if (!int_bn_mod_inverse(ret->Ai, ret->A, ret->mod, ctx, &rv)) {\n            if (rv) {\n                if (retry_counter-- == 0) {\n                    BNerr(BN_F_BN_BLINDING_CREATE_PARAM,\n                          BN_R_TOO_MANY_ITERATIONS);\n                    goto err;\n                }\n            } else\n                goto err;\n        } else\n            break;\n    } while (1);\n    if (ret->bn_mod_exp != NULL && ret->m_ctx != NULL) {\n        if (!ret->bn_mod_exp\n            (ret->A, ret->A, ret->e, ret->mod, ctx, ret->m_ctx))\n            goto err;\n    } else {\n        if (!BN_mod_exp(ret->A, ret->A, ret->e, ret->mod, ctx))\n            goto err;\n    }\n    return ret;\n err:\n    if (b == NULL) {\n        BN_BLINDING_free(ret);\n        ret = NULL;\n    }\n    return ret;\n}', 'BIGNUM *BN_dup(const BIGNUM *a)\n{\n    BIGNUM *t;\n    if (a == NULL)\n        return NULL;\n    bn_check_top(a);\n    t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new();\n    if (t == NULL)\n        return NULL;\n    if (!BN_copy(t, a)) {\n        BN_free(t);\n        return NULL;\n    }\n    bn_check_top(t);\n    return t;\n}', 'BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)\n{\n    bn_check_top(b);\n    if (a == b)\n        return a;\n    if (bn_wexpand(a, b->top) == NULL)\n        return NULL;\n    if (b->top > 0)\n        memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);\n    a->neg = b->neg;\n    a->top = b->top;\n    a->flags |= b->flags & BN_FLG_FIXED_TOP;\n    bn_check_top(a);\n    return a;\n}']