crypto/ec/ecp_smpl.c:1348: error: BUFFER_OVERRUN_L3
  Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`.
Showing all 10 steps of the trace


crypto/ec/ecp_smpl.c:1220:5: Call
1218.       }
1219.   
1220.       BN_CTX_start(ctx);
            ^
1221.       tmp = BN_CTX_get(ctx);
1222.       tmp_Z = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
  169.   }
  170.   
  171. > void BN_CTX_start(BN_CTX *ctx)
  172.   {
  173.       CTXDBG("ENTER BN_CTX_start()", ctx);

crypto/ec/ecp_smpl.c:1348:5: Call
1346.   
1347.    err:
1348.       BN_CTX_end(ctx);
            ^
1349.       BN_CTX_free(new_ctx);
1350.       if (prod_Z != NULL) {

crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
  183.   }
  184.   
  185. > void BN_CTX_end(BN_CTX *ctx)
  186.   {
  187.       CTXDBG("ENTER BN_CTX_end()", ctx);

crypto/bn/bn_ctx.c:191:27: Call
  189.           ctx->err_stack--;
  190.       else {
  191.           unsigned int fp = BN_STACK_pop(&ctx->stack);
                                   ^
  192.           /* Does this stack frame have anything to release? */
  193.           if (fp < ctx->used)

crypto/bn/bn_ctx.c:266:1: <Offset trace>
264.   }
265.   
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267.   {
268.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
    264.   }
    265.   
    266. > static unsigned int BN_STACK_pop(BN_STACK *st)
    267.   {
    268.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:266:1: <Length trace>
264.   }
265.   
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267.   {
268.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
    264.   }
    265.   
    266. > static unsigned int BN_STACK_pop(BN_STACK *st)
    267.   {
    268.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end` 
    266.   static unsigned int BN_STACK_pop(BN_STACK *st)
    267.   {
    268.       return st->indexes[--(st->depth)];
                      ^
    269.   }
    270.   

static unsigned int BN_STACK_pop(BN_STACK *st)
{
    return st->indexes[--(st->depth)];
}
['int ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num,\n                                     EC_POINT *points[], BN_CTX *ctx)\n{\n    BN_CTX *new_ctx = NULL;\n    BIGNUM *tmp, *tmp_Z;\n    BIGNUM **prod_Z = NULL;\n    size_t i;\n    int ret = 0;\n    if (num == 0)\n        return 1;\n    if (ctx == NULL) {\n        ctx = new_ctx = BN_CTX_new();\n        if (ctx == NULL)\n            return 0;\n    }\n    BN_CTX_start(ctx);\n    tmp = BN_CTX_get(ctx);\n    tmp_Z = BN_CTX_get(ctx);\n    if (tmp_Z == NULL)\n        goto err;\n    prod_Z = OPENSSL_malloc(num * sizeof(prod_Z[0]));\n    if (prod_Z == NULL)\n        goto err;\n    for (i = 0; i < num; i++) {\n        prod_Z[i] = BN_new();\n        if (prod_Z[i] == NULL)\n            goto err;\n    }\n    if (!BN_is_zero(points[0]->Z)) {\n        if (!BN_copy(prod_Z[0], points[0]->Z))\n            goto err;\n    } else {\n        if (group->meth->field_set_to_one != 0) {\n            if (!group->meth->field_set_to_one(group, prod_Z[0], ctx))\n                goto err;\n        } else {\n            if (!BN_one(prod_Z[0]))\n                goto err;\n        }\n    }\n    for (i = 1; i < num; i++) {\n        if (!BN_is_zero(points[i]->Z)) {\n            if (!group->\n                meth->field_mul(group, prod_Z[i], prod_Z[i - 1], points[i]->Z,\n                                ctx))\n                goto err;\n        } else {\n            if (!BN_copy(prod_Z[i], prod_Z[i - 1]))\n                goto err;\n        }\n    }\n    if (!group->meth->field_inv(group, tmp, prod_Z[num - 1], ctx)) {\n        ECerr(EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE, ERR_R_BN_LIB);\n        goto err;\n    }\n    if (group->meth->field_encode != 0) {\n        if (!group->meth->field_encode(group, tmp, tmp, ctx))\n            goto err;\n        if (!group->meth->field_encode(group, tmp, tmp, ctx))\n            goto err;\n    }\n    for (i = num - 1; i > 0; --i) {\n        if (!BN_is_zero(points[i]->Z)) {\n            if (!group->\n                meth->field_mul(group, tmp_Z, prod_Z[i - 1], tmp, ctx))\n                goto err;\n            if (!group->meth->field_mul(group, tmp, tmp, points[i]->Z, ctx))\n                goto err;\n            if (!BN_copy(points[i]->Z, tmp_Z))\n                goto err;\n        }\n    }\n    if (!BN_is_zero(points[0]->Z)) {\n        if (!BN_copy(points[0]->Z, tmp))\n            goto err;\n    }\n    for (i = 0; i < num; i++) {\n        EC_POINT *p = points[i];\n        if (!BN_is_zero(p->Z)) {\n            if (!group->meth->field_sqr(group, tmp, p->Z, ctx))\n                goto err;\n            if (!group->meth->field_mul(group, p->X, p->X, tmp, ctx))\n                goto err;\n            if (!group->meth->field_mul(group, tmp, tmp, p->Z, ctx))\n                goto err;\n            if (!group->meth->field_mul(group, p->Y, p->Y, tmp, ctx))\n                goto err;\n            if (group->meth->field_set_to_one != 0) {\n                if (!group->meth->field_set_to_one(group, p->Z, ctx))\n                    goto err;\n            } else {\n                if (!BN_one(p->Z))\n                    goto err;\n            }\n            p->Z_is_one = 1;\n        }\n    }\n    ret = 1;\n err:\n    BN_CTX_end(ctx);\n    BN_CTX_free(new_ctx);\n    if (prod_Z != NULL) {\n        for (i = 0; i < num; i++) {\n            if (prod_Z[i] == NULL)\n                break;\n            BN_clear_free(prod_Z[i]);\n        }\n        OPENSSL_free(prod_Z);\n    }\n    return ret;\n}', 'void BN_CTX_start(BN_CTX *ctx)\n{\n    CTXDBG("ENTER BN_CTX_start()", ctx);\n    if (ctx->err_stack || ctx->too_many)\n        ctx->err_stack++;\n    else if (!BN_STACK_push(&ctx->stack, ctx->used)) {\n        BNerr(BN_F_BN_CTX_START, BN_R_TOO_MANY_TEMPORARY_VARIABLES);\n        ctx->err_stack++;\n    }\n    CTXDBG("LEAVE BN_CTX_start()", ctx);\n}', 'void BN_CTX_end(BN_CTX *ctx)\n{\n    CTXDBG("ENTER BN_CTX_end()", ctx);\n    if (ctx->err_stack)\n        ctx->err_stack--;\n    else {\n        unsigned int fp = BN_STACK_pop(&ctx->stack);\n        if (fp < ctx->used)\n            BN_POOL_release(&ctx->pool, ctx->used - fp);\n        ctx->used = fp;\n        ctx->too_many = 0;\n    }\n    CTXDBG("LEAVE BN_CTX_end()", ctx);\n}', 'static unsigned int BN_STACK_pop(BN_STACK *st)\n{\n    return st->indexes[--(st->depth)];\n}']