crypto/ec/ecp_smpl.c:1514: error: BUFFER_OVERRUN_L3
  Offset: 0 Size: [0, 8388607] by call to `BN_mod_sub_quick`.
Showing all 15 steps of the trace


crypto/ec/ecp_smpl.c:1499:10: Call
1497.   
1498.       BN_CTX_start(ctx);
1499.       t0 = BN_CTX_get(ctx);
                 ^
1500.       t1 = BN_CTX_get(ctx);
1501.       t2 = 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:359:1: Parameter `*a->d`
    357.   }
    358.   
    359. > int BN_set_word(BIGNUM *a, BN_ULONG w)
    360.   {
    361.       bn_check_top(a);

crypto/bn/bn_lib.c:362:9: Call
    360.   {
    361.       bn_check_top(a);
    362.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                   ^
    363.           return 0;
    364.       a->neg = 0;

crypto/bn/bn_lcl.h:660:1: Parameter `*a->d`
      658.                            const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
      659.   
      660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
      661.   {
      662.       if (bits > (INT_MAX - BN_BITS2 + 1))

crypto/ec/ecp_smpl.c:1514:13: Call
1512.           || !group->meth->field_mul(group, t3, r->Z, s->X, ctx)
1513.           || !group->meth->field_mul(group, t4, group->a, t1, ctx)
1514.           || !BN_mod_sub_quick(t4, t0, t4, group->field)
                    ^
1515.           || !BN_mod_add_quick(t5, t3, t2, group->field)
1516.           || !group->meth->field_sqr(group, t4, t4, ctx)

crypto/bn/bn_mod.c:117:1: Parameter `*r->d`
  115.    * less than m
  116.    */
  117. > int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
  118.                        const BIGNUM *m)
  119.   {

crypto/bn/bn_mod.c:120:10: Call
  118.                        const BIGNUM *m)
  119.   {
  120.       if (!BN_sub(r, a, b))
                  ^
  121.           return 0;
  122.       if (r->neg)

crypto/bn/bn_add.c:45:1: Parameter `*r->d`
    43.   
    44.   /* signed sub of b from a. */
    45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
    46.   {
    47.       int ret, r_neg, cmp_res;

crypto/bn/bn_add.c:65:13: Call
    63.           } else {
    64.               r_neg = 0;
    65.               BN_zero(r);
                      ^
    66.               ret = 1;
    67.           }

crypto/bn/bn_lib.c:359:1: <Length trace>
357.   }
358.   
359. > int BN_set_word(BIGNUM *a, BN_ULONG w)
360.   {
361.       bn_check_top(a);

crypto/bn/bn_lib.c:359:1: Parameter `*a->d`
      357.   }
      358.   
      359. > int BN_set_word(BIGNUM *a, BN_ULONG w)
      360.   {
      361.       bn_check_top(a);

crypto/bn/bn_lib.c:362:9: Call
      360.   {
      361.       bn_check_top(a);
      362.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                     ^
      363.           return 0;
      364.       a->neg = 0;

crypto/bn/bn_lcl.h:660:1: Parameter `*a->d`
        658.                            const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
        659.   
        660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
        661.   {
        662.       if (bits > (INT_MAX - BN_BITS2 + 1))

crypto/bn/bn_lib.c:365:5: Array access: Offset: 0 Size: [0, 8388607] by call to `BN_mod_sub_quick` 
      363.           return 0;
      364.       a->neg = 0;
      365.       a->d[0] = w;
                 ^
      366.       a->top = (w ? 1 : 0);
      367.       a->flags &= ~BN_FLG_FIXED_TOP;

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);
    a->flags &= ~BN_FLG_FIXED_TOP;
    bn_check_top(a);
    return 1;
}
['int ec_GFp_simple_ladder_step(const EC_GROUP *group,\n                              EC_POINT *r, EC_POINT *s,\n                              EC_POINT *p, BN_CTX *ctx)\n{\n    int ret = 0;\n    BIGNUM *t0, *t1, *t2, *t3, *t4, *t5, *t6, *t7 = NULL;\n    BN_CTX_start(ctx);\n    t0 = BN_CTX_get(ctx);\n    t1 = BN_CTX_get(ctx);\n    t2 = BN_CTX_get(ctx);\n    t3 = BN_CTX_get(ctx);\n    t4 = BN_CTX_get(ctx);\n    t5 = BN_CTX_get(ctx);\n    t6 = BN_CTX_get(ctx);\n    t7 = BN_CTX_get(ctx);\n    if (t7 == NULL\n        || !group->meth->field_mul(group, t0, r->X, s->X, ctx)\n        || !group->meth->field_mul(group, t1, r->Z, s->Z, ctx)\n        || !group->meth->field_mul(group, t2, r->X, s->Z, ctx)\n        || !group->meth->field_mul(group, t3, r->Z, s->X, ctx)\n        || !group->meth->field_mul(group, t4, group->a, t1, ctx)\n        || !BN_mod_sub_quick(t4, t0, t4, group->field)\n        || !BN_mod_add_quick(t5, t3, t2, group->field)\n        || !group->meth->field_sqr(group, t4, t4, ctx)\n        || !group->meth->field_mul(group, t5, t1, t5, ctx)\n        || !BN_mod_lshift_quick(t0, group->b, 2, group->field)\n        || !group->meth->field_mul(group, t5, t0, t5, ctx)\n        || !BN_mod_sub_quick(t5, t4, t5, group->field)\n        || !group->meth->field_mul(group, s->X, t5, p->Z, ctx)\n        || !BN_mod_sub_quick(t3, t2, t3, group->field)\n        || !group->meth->field_sqr(group, t3, t3, ctx)\n        || !group->meth->field_mul(group, s->Z, t3, p->X, ctx)\n        || !group->meth->field_sqr(group, t2, r->X, ctx)\n        || !group->meth->field_sqr(group, t4, r->Z, ctx)\n        || !group->meth->field_mul(group, t1, t4, group->a, ctx)\n        || !BN_mod_add_quick(t6, r->X, r->Z, group->field)\n        || !group->meth->field_sqr(group, t6, t6, ctx)\n        || !BN_mod_sub_quick(t6, t6, t2, group->field)\n        || !BN_mod_sub_quick(t6, t6, t4, group->field)\n        || !BN_mod_sub_quick(t7, t2, t1, group->field)\n        || !group->meth->field_sqr(group, t7, t7, ctx)\n        || !group->meth->field_mul(group, t5, t4, t6, ctx)\n        || !group->meth->field_mul(group, t5, t0, t5, ctx)\n        || !BN_mod_sub_quick(r->X, t7, t5, group->field)\n        || !BN_mod_add_quick(t2, t2, t1, group->field)\n        || !group->meth->field_sqr(group, t5, t4, ctx)\n        || !group->meth->field_mul(group, t5, t5, t0, ctx)\n        || !group->meth->field_mul(group, t6, t6, t2, ctx)\n        || !BN_mod_lshift1_quick(t6, t6, group->field)\n        || !BN_mod_add_quick(r->Z, t5, t6, group->field))\n        goto err;\n    ret = 1;\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    a->flags &= ~BN_FLG_FIXED_TOP;\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}', 'int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\n                     const BIGNUM *m)\n{\n    if (!BN_sub(r, a, b))\n        return 0;\n    if (r->neg)\n        return BN_add(r, r, m);\n    return 1;\n}', 'int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)\n{\n    int ret, r_neg, cmp_res;\n    bn_check_top(a);\n    bn_check_top(b);\n    if (a->neg != b->neg) {\n        r_neg = a->neg;\n        ret = BN_uadd(r, a, b);\n    } else {\n        cmp_res = BN_ucmp(a, b);\n        if (cmp_res > 0) {\n            r_neg = a->neg;\n            ret = BN_usub(r, a, b);\n        } else if (cmp_res < 0) {\n            r_neg = !b->neg;\n            ret = BN_usub(r, b, a);\n        } else {\n            r_neg = 0;\n            BN_zero(r);\n            ret = 1;\n        }\n    }\n    r->neg = r_neg;\n    bn_check_top(r);\n    return ret;\n}']