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


crypto/dh/dh_gen.c:68:5: Call
66.       if (ctx == NULL)
67.           goto err;
68.       BN_CTX_start(ctx);
          ^
69.       t1 = BN_CTX_get(ctx);
70.       t2 = 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/dh/dh_gen.c:126:9: Call
124.   
125.       if (ctx != NULL) {
126.           BN_CTX_end(ctx);
               ^
127.           BN_CTX_free(ctx);
128.       }

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)];
}
['static int dh_builtin_genparams(DH *ret, int prime_len, int generator,\n                                BN_GENCB *cb)\n{\n    BIGNUM *t1, *t2;\n    int g, ok = -1;\n    BN_CTX *ctx = NULL;\n    ctx = BN_CTX_new();\n    if (ctx == NULL)\n        goto err;\n    BN_CTX_start(ctx);\n    t1 = BN_CTX_get(ctx);\n    t2 = BN_CTX_get(ctx);\n    if (t2 == NULL)\n        goto err;\n    if (!ret->p && ((ret->p = BN_new()) == NULL))\n        goto err;\n    if (!ret->g && ((ret->g = BN_new()) == NULL))\n        goto err;\n    if (generator <= 1) {\n        DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_BAD_GENERATOR);\n        goto err;\n    }\n    if (generator == DH_GENERATOR_2) {\n        if (!BN_set_word(t1, 24))\n            goto err;\n        if (!BN_set_word(t2, 11))\n            goto err;\n        g = 2;\n    } else if (generator == DH_GENERATOR_5) {\n        if (!BN_set_word(t1, 10))\n            goto err;\n        if (!BN_set_word(t2, 3))\n            goto err;\n        g = 5;\n    } else {\n        if (!BN_set_word(t1, 2))\n            goto err;\n        if (!BN_set_word(t2, 1))\n            goto err;\n        g = generator;\n    }\n    if (!BN_generate_prime_ex(ret->p, prime_len, 1, t1, t2, cb))\n        goto err;\n    if (!BN_GENCB_call(cb, 3, 0))\n        goto err;\n    if (!BN_set_word(ret->g, g))\n        goto err;\n    ok = 1;\n err:\n    if (ok == -1) {\n        DHerr(DH_F_DH_BUILTIN_GENPARAMS, ERR_R_BN_LIB);\n        ok = 0;\n    }\n    if (ctx != NULL) {\n        BN_CTX_end(ctx);\n        BN_CTX_free(ctx);\n    }\n    return ok;\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}']