test/bntest.c:2273: 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:2273:14: Call
2271.       for (i = 0; i < 2; i++) {
2272.           BN_CTX *c = i == 0 ? nctx : sctx;
2273.           if (!TEST_true(test_ctx_set_ct_flag(c))
                     ^
2274.                   || !TEST_true(test_ctx_check_ct_flag(c)))
2275.               goto err;

test/bntest.c:2199:1: Parameter `c->stack.depth`
  2197.   }
  2198.   
  2199. > static int test_ctx_set_ct_flag(BN_CTX *c)
  2200.   {
  2201.       int st = 0;

test/bntest.c:2205:5: Call
  2203.       BIGNUM *b[15];
  2204.   
  2205.       BN_CTX_start(c);
              ^
  2206.       for (i = 0; i < OSSL_NELEM(b); i++) {
  2207.           if (!TEST_ptr(b[i] = BN_CTX_get(c)))

crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
    179.   }
    180.   
    181. > void BN_CTX_start(BN_CTX *ctx)
    182.   {
    183.       CTXDBG_ENTRY("BN_CTX_start", ctx);

test/bntest.c:2215:5: Call
  2213.       st = 1;
  2214.    err:
  2215.       BN_CTX_end(c);
              ^
  2216.       return st;
  2217.   }

crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth`
    193.   }
    194.   
    195. > void BN_CTX_end(BN_CTX *ctx)
    196.   {
    197.       CTXDBG_ENTRY("BN_CTX_end", ctx);

test/bntest.c:2273:14: Call
2271.       for (i = 0; i < 2; i++) {
2272.           BN_CTX *c = i == 0 ? nctx : sctx;
2273.           if (!TEST_true(test_ctx_set_ct_flag(c))
                     ^
2274.                   || !TEST_true(test_ctx_check_ct_flag(c)))
2275.               goto err;

test/bntest.c:2199:1: Parameter `c->stack.depth`
  2197.   }
  2198.   
  2199. > static int test_ctx_set_ct_flag(BN_CTX *c)
  2200.   {
  2201.       int st = 0;

test/bntest.c:2205:5: Call
  2203.       BIGNUM *b[15];
  2204.   
  2205.       BN_CTX_start(c);
              ^
  2206.       for (i = 0; i < OSSL_NELEM(b); i++) {
  2207.           if (!TEST_ptr(b[i] = BN_CTX_get(c)))

crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
    179.   }
    180.   
    181. > void BN_CTX_start(BN_CTX *ctx)
    182.   {
    183.       CTXDBG_ENTRY("BN_CTX_start", ctx);

test/bntest.c:2215:5: Call
  2213.       st = 1;
  2214.    err:
  2215.       BN_CTX_end(c);
              ^
  2216.       return st;
  2217.   }

crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth`
    193.   }
    194.   
    195. > void BN_CTX_end(BN_CTX *ctx)
    196.   {
    197.       CTXDBG_ENTRY("BN_CTX_end", ctx);

crypto/bn/bn_ctx.c:201:27: Call
    199.           ctx->err_stack--;
    200.       else {
    201.           unsigned int fp = BN_STACK_pop(&ctx->stack);
                                     ^
    202.           /* Does this stack frame have anything to release? */
    203.           if (fp < ctx->used)

crypto/bn/bn_ctx.c:276:1: <LHS trace>
274.   }
275.   
276. > static unsigned int BN_STACK_pop(BN_STACK *st)
277.   {
278.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:276:1: Parameter `st->depth`
      274.   }
      275.   
      276. > static unsigned int BN_STACK_pop(BN_STACK *st)
      277.   {
      278.       return st->indexes[--(st->depth)];

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

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_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}']