crypto/bn/bn_exp.c:192: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end`.
Showing all 9 steps of the trace


crypto/bn/bn_exp.c:148:1: Parameter `ctx->stack.depth`
146.   
147.   /* this one works - simple but works */
148. > int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
149.   {
150.       int i, bits, ret = 0;

crypto/bn/bn_exp.c:159:5: Call
157.       }
158.   
159.       BN_CTX_start(ctx);
           ^
160.       if ((r == a) || (r == p))
161.           rr = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:227:1: Parameter `ctx->stack.depth`
  225.   }
  226.   
  227. > void BN_CTX_start(BN_CTX *ctx)
  228.   {
  229.       CTXDBG_ENTRY("BN_CTX_start", ctx);

crypto/bn/bn_exp.c:192:5: Call
190.       if (r != rr)
191.           BN_copy(r, rr);
192.       BN_CTX_end(ctx);
           ^
193.       bn_check_top(r);
194.       return (ret);

crypto/bn/bn_ctx.c:241:1: Parameter `ctx->stack.depth`
  239.   }
  240.   
  241. > void BN_CTX_end(BN_CTX *ctx)
  242.   {
  243.       CTXDBG_ENTRY("BN_CTX_end", ctx);

crypto/bn/bn_ctx.c:247:27: Call
  245.           ctx->err_stack--;
  246.       else {
  247.           unsigned int fp = BN_STACK_pop(&ctx->stack);
                                   ^
  248.           /* Does this stack frame have anything to release? */
  249.           if (fp < ctx->used)

crypto/bn/bn_ctx.c:319:1: <LHS trace>
317.   }
318.   
319. > static unsigned int BN_STACK_pop(BN_STACK *st)
320.   {
321.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:319:1: Parameter `st->depth`
    317.   }
    318.   
    319. > static unsigned int BN_STACK_pop(BN_STACK *st)
    320.   {
    321.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:321:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end` 
    319.   static unsigned int BN_STACK_pop(BN_STACK *st)
    320.   {
    321.       return st->indexes[--(st->depth)];
                      ^
    322.   }
    323.   

static unsigned int BN_STACK_pop(BN_STACK *st)
{
    return st->indexes[--(st->depth)];
}
['int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)\n{\n    int i, bits, ret = 0;\n    BIGNUM *v, *rr;\n    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {\n        BNerr(BN_F_BN_EXP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);\n        return -1;\n    }\n    BN_CTX_start(ctx);\n    if ((r == a) || (r == p))\n        rr = BN_CTX_get(ctx);\n    else\n        rr = r;\n    v = BN_CTX_get(ctx);\n    if (rr == NULL || v == NULL)\n        goto err;\n    if (BN_copy(v, a) == NULL)\n        goto err;\n    bits = BN_num_bits(p);\n    if (BN_is_odd(p)) {\n        if (BN_copy(rr, a) == NULL)\n            goto err;\n    } else {\n        if (!BN_one(rr))\n            goto err;\n    }\n    for (i = 1; i < bits; i++) {\n        if (!BN_sqr(v, v, ctx))\n            goto err;\n        if (BN_is_bit_set(p, i)) {\n            if (!BN_mul(rr, rr, v, ctx))\n                goto err;\n        }\n    }\n    ret = 1;\n err:\n    if (r != rr)\n        BN_copy(r, rr);\n    BN_CTX_end(ctx);\n    bn_check_top(r);\n    return (ret);\n}', 'void BN_CTX_start(BN_CTX *ctx)\n{\n    CTXDBG_ENTRY("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_EXIT(ctx);\n}', 'void BN_CTX_end(BN_CTX *ctx)\n{\n    CTXDBG_ENTRY("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_EXIT(ctx);\n}', 'static unsigned int BN_STACK_pop(BN_STACK *st)\n{\n    return st->indexes[--(st->depth)];\n}']