crypto/ec/ec2_mult.c:144: error: BUFFER_OVERRUN_L3
  Offset: 0 Size: [0, 8388607] by call to `BN_set_word`.
Showing all 11 steps of the trace


crypto/ec/ec2_mult.c:138:10: Call
136.       /* Since Mxy is static we can guarantee that ctx != NULL. */
137.       BN_CTX_start(ctx);
138.       t3 = BN_CTX_get(ctx);
                ^
139.       t4 = BN_CTX_get(ctx);
140.       t5 = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:229:5: Call
  227.       }
  228.       /* OK, make sure the returned bignum is "zero" */
  229.       BN_zero(ret);
             ^
  230.       ctx->used++;
  231.       CTXDBG_RET(ctx, ret);

crypto/bn/bn_lib.c:387:1: Parameter `*a->d`
    385.   }
    386.   
    387. > int BN_set_word(BIGNUM *a, BN_ULONG w)
    388.   {
    389.       bn_check_top(a);

crypto/bn/bn_lib.c:390:9: Call
    388.   {
    389.       bn_check_top(a);
    390.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                   ^
    391.           return 0;
    392.       a->neg = 0;

crypto/bn/bn_lcl.h:651:1: Parameter `*a->d`
      649.                            const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
      650.   
      651. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
      652.   {
      653.       if (bits > (INT_MAX - BN_BITS2 + 1))

crypto/ec/ec2_mult.c:144:10: Call
142.           goto err;
143.   
144.       if (!BN_one(t5))
                ^
145.           goto err;
146.   

crypto/bn/bn_lib.c:387:1: <Length trace>
385.   }
386.   
387. > int BN_set_word(BIGNUM *a, BN_ULONG w)
388.   {
389.       bn_check_top(a);

crypto/bn/bn_lib.c:387:1: Parameter `*a->d`
  385.   }
  386.   
  387. > int BN_set_word(BIGNUM *a, BN_ULONG w)
  388.   {
  389.       bn_check_top(a);

crypto/bn/bn_lib.c:390:9: Call
  388.   {
  389.       bn_check_top(a);
  390.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  391.           return 0;
  392.       a->neg = 0;

crypto/bn/bn_lcl.h:651:1: Parameter `*a->d`
    649.                            const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
    650.   
    651. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
    652.   {
    653.       if (bits > (INT_MAX - BN_BITS2 + 1))

crypto/bn/bn_lib.c:393:5: Array access: Offset: 0 Size: [0, 8388607] by call to `BN_set_word` 
  391.           return 0;
  392.       a->neg = 0;
  393.       a->d[0] = w;
             ^
  394.       a->top = (w ? 1 : 0);
  395.       bn_check_top(a);

int BN_set_word(BIGNUM *a, BN_ULONG w)
{
    bn_check_top(a);
    if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
        return 0;
    a->neg = 0;
    a->d[0] = w;
    a->top = (w ? 1 : 0);
    bn_check_top(a);
    return 1;
}
['static int gf2m_Mxy(const EC_GROUP *group, const BIGNUM *x, const BIGNUM *y,\n                    BIGNUM *x1, BIGNUM *z1, BIGNUM *x2, BIGNUM *z2,\n                    BN_CTX *ctx)\n{\n    BIGNUM *t3, *t4, *t5;\n    int ret = 0;\n    if (BN_is_zero(z1)) {\n        BN_zero(x2);\n        BN_zero(z2);\n        return 1;\n    }\n    if (BN_is_zero(z2)) {\n        if (!BN_copy(x2, x))\n            return 0;\n        if (!BN_GF2m_add(z2, x, y))\n            return 0;\n        return 2;\n    }\n    BN_CTX_start(ctx);\n    t3 = BN_CTX_get(ctx);\n    t4 = BN_CTX_get(ctx);\n    t5 = BN_CTX_get(ctx);\n    if (t5 == NULL)\n        goto err;\n    if (!BN_one(t5))\n        goto err;\n    if (!group->meth->field_mul(group, t3, z1, z2, ctx))\n        goto err;\n    if (!group->meth->field_mul(group, z1, z1, x, ctx))\n        goto err;\n    if (!BN_GF2m_add(z1, z1, x1))\n        goto err;\n    if (!group->meth->field_mul(group, z2, z2, x, ctx))\n        goto err;\n    if (!group->meth->field_mul(group, x1, z2, x1, ctx))\n        goto err;\n    if (!BN_GF2m_add(z2, z2, x2))\n        goto err;\n    if (!group->meth->field_mul(group, z2, z2, z1, ctx))\n        goto err;\n    if (!group->meth->field_sqr(group, t4, x, ctx))\n        goto err;\n    if (!BN_GF2m_add(t4, t4, y))\n        goto err;\n    if (!group->meth->field_mul(group, t4, t4, t3, ctx))\n        goto err;\n    if (!BN_GF2m_add(t4, t4, z2))\n        goto err;\n    if (!group->meth->field_mul(group, t3, t3, x, ctx))\n        goto err;\n    if (!group->meth->field_div(group, t3, t5, t3, ctx))\n        goto err;\n    if (!group->meth->field_mul(group, t4, t3, t4, ctx))\n        goto err;\n    if (!group->meth->field_mul(group, x2, x1, t3, ctx))\n        goto err;\n    if (!BN_GF2m_add(z2, x2, x))\n        goto err;\n    if (!group->meth->field_mul(group, z2, z2, t4, ctx))\n        goto err;\n    if (!BN_GF2m_add(z2, z2, y))\n        goto err;\n    ret = 2;\n err:\n    BN_CTX_end(ctx);\n    return ret;\n}', 'BIGNUM *BN_CTX_get(BN_CTX *ctx)\n{\n    BIGNUM *ret;\n    CTXDBG_ENTRY("BN_CTX_get", ctx);\n    if (ctx->err_stack || ctx->too_many)\n        return NULL;\n    if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {\n        ctx->too_many = 1;\n        BNerr(BN_F_BN_CTX_GET, BN_R_TOO_MANY_TEMPORARY_VARIABLES);\n        return NULL;\n    }\n    BN_zero(ret);\n    ctx->used++;\n    CTXDBG_RET(ctx, ret);\n    return ret;\n}', 'int BN_set_word(BIGNUM *a, BN_ULONG w)\n{\n    bn_check_top(a);\n    if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)\n        return 0;\n    a->neg = 0;\n    a->d[0] = w;\n    a->top = (w ? 1 : 0);\n    bn_check_top(a);\n    return 1;\n}', 'static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)\n{\n    if (bits > (INT_MAX - BN_BITS2 + 1))\n        return NULL;\n    if (((bits+BN_BITS2-1)/BN_BITS2) <= (a)->dmax)\n        return a;\n    return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2);\n}']