test/bntest.c:2311: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `test_ctx_set_ct_flag`.
Showing all 16 steps of the trace


test/bntest.c:2311:14: Call
2309.       for (i = 0; i < 2; i++) {
2310.           BN_CTX *c = i == 0 ? nctx : sctx;
2311.           if (!TEST_true(test_ctx_set_ct_flag(c))
                     ^
2312.                   || !TEST_true(test_ctx_check_ct_flag(c)))
2313.               goto err;

test/bntest.c:2237:1: Parameter `c->stack.depth`
  2235.   }
  2236.   
  2237. > static int test_ctx_set_ct_flag(BN_CTX *c)
  2238.   {
  2239.       int st = 0;

test/bntest.c:2243:5: Call
  2241.       BIGNUM *b[15];
  2242.   
  2243.       BN_CTX_start(c);
              ^
  2244.       for (i = 0; i < OSSL_NELEM(b); i++) {
  2245.           if (!TEST_ptr(b[i] = BN_CTX_get(c)))

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

test/bntest.c:2253:5: Call
  2251.       st = 1;
  2252.    err:
  2253.       BN_CTX_end(c);
              ^
  2254.       return st;
  2255.   }

crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth`
    183.   }
    184.   
    185. > void BN_CTX_end(BN_CTX *ctx)
    186.   {
    187.       if (ctx == NULL)

test/bntest.c:2311:14: Call
2309.       for (i = 0; i < 2; i++) {
2310.           BN_CTX *c = i == 0 ? nctx : sctx;
2311.           if (!TEST_true(test_ctx_set_ct_flag(c))
                     ^
2312.                   || !TEST_true(test_ctx_check_ct_flag(c)))
2313.               goto err;

test/bntest.c:2237:1: Parameter `c->stack.depth`
  2235.   }
  2236.   
  2237. > static int test_ctx_set_ct_flag(BN_CTX *c)
  2238.   {
  2239.       int st = 0;

test/bntest.c:2243:5: Call
  2241.       BIGNUM *b[15];
  2242.   
  2243.       BN_CTX_start(c);
              ^
  2244.       for (i = 0; i < OSSL_NELEM(b); i++) {
  2245.           if (!TEST_ptr(b[i] = BN_CTX_get(c)))

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

test/bntest.c:2253:5: Call
  2251.       st = 1;
  2252.    err:
  2253.       BN_CTX_end(c);
              ^
  2254.       return st;
  2255.   }

crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth`
    183.   }
    184.   
    185. > void BN_CTX_end(BN_CTX *ctx)
    186.   {
    187.       if (ctx == NULL)

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

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

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

crypto/bn/bn_ctx.c:270:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `test_ctx_set_ct_flag` 
      268.   static unsigned int BN_STACK_pop(BN_STACK *st)
      269.   {
      270.       return st->indexes[--(st->depth)];
                        ^
      271.   }
      272.   

static unsigned int BN_STACK_pop(BN_STACK *st)
{
    return st->indexes[--(st->depth)];
}
['static int test_ctx_consttime_flag(void)\n{\n    BN_CTX *nctx = NULL;\n    BN_CTX *sctx = NULL;\n    size_t i = 0;\n    int st = 0;\n    if (!TEST_ptr(nctx = BN_CTX_new())\n            || !TEST_ptr(sctx = BN_CTX_secure_new()))\n        goto err;\n    for (i = 0; i < 2; i++) {\n        BN_CTX *c = i == 0 ? nctx : sctx;\n        if (!TEST_true(test_ctx_set_ct_flag(c))\n                || !TEST_true(test_ctx_check_ct_flag(c)))\n            goto err;\n    }\n    st = 1;\n err:\n    BN_CTX_free(nctx);\n    BN_CTX_free(sctx);\n    return st;\n}', 'static int test_ctx_set_ct_flag(BN_CTX *c)\n{\n    int st = 0;\n    size_t i;\n    BIGNUM *b[15];\n    BN_CTX_start(c);\n    for (i = 0; i < OSSL_NELEM(b); i++) {\n        if (!TEST_ptr(b[i] = BN_CTX_get(c)))\n            goto err;\n        if (i % 2 == 1)\n            BN_set_flags(b[i], BN_FLG_CONSTTIME);\n    }\n    st = 1;\n err:\n    BN_CTX_end(c);\n    return st;\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    if (ctx == NULL)\n        return;\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}']