crypto/bn/bntest.c:1943: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `bn_probable_prime_dh_coprime`.
Showing all 11 steps of the trace


crypto/bn/bntest.c:1933:1: Parameter `ctx->stack.depth`
1931.   	}
1932.   
1933. > int test_probable_prime_coprime(BIO *bp, BN_CTX *ctx)
1934.   	{
1935.   	int i, j, ret = 0;

crypto/bn/bntest.c:1943:8: Call
1941.   	for (i = 0; i < 1000; i++)
1942.   		{
1943.   		if (!bn_probable_prime_dh_coprime(&r, 1024, ctx)) goto err;
               ^
1944.   		
1945.   		for (j = 0; j < 5; j++)

crypto/bn/bn_prime.c:433:1: Parameter `ctx->stack.depth`
  431.   	}
  432.   
  433. > int bn_probable_prime_dh_coprime(BIGNUM *rnd, int bits, BN_CTX *ctx)
  434.   	{
  435.   	int i;

crypto/bn/bn_prime.c:442:2: Call
  440.   	OPENSSL_assert(bits > prime_multiplier_bits);
  441.   	
  442.   	BN_CTX_start(ctx);
          ^
  443.   	if ((offset_index = BN_CTX_get(ctx)) == NULL) goto err;
  444.   	if ((offset_count = BN_CTX_get(ctx)) == NULL) goto err;

crypto/bn/bn_ctx.c:257:1: Parameter `ctx->stack.depth`
    255.   	}
    256.   
    257. > void BN_CTX_start(BN_CTX *ctx)
    258.   	{
    259.   	CTXDBG_ENTRY("BN_CTX_start", ctx);

crypto/bn/bn_prime.c:470:2: Call
  468.   
  469.   err:
  470.   	BN_CTX_end(ctx);
          ^
  471.   	bn_check_top(rnd);
  472.   	return ret;

crypto/bn/bn_ctx.c:272:1: Parameter `ctx->stack.depth`
    270.   	}
    271.   
    272. > void BN_CTX_end(BN_CTX *ctx)
    273.   	{
    274.   	CTXDBG_ENTRY("BN_CTX_end", ctx);

crypto/bn/bn_ctx.c:279:21: Call
    277.   	else
    278.   		{
    279.   		unsigned int fp = BN_STACK_pop(&ctx->stack);
                               ^
    280.   		/* Does this stack frame have anything to release? */
    281.   		if(fp < ctx->used)

crypto/bn/bn_ctx.c:353:1: <LHS trace>
351.   	}
352.   
353. > static unsigned int BN_STACK_pop(BN_STACK *st)
354.   	{
355.   	return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:353:1: Parameter `st->depth`
      351.   	}
      352.   
      353. > static unsigned int BN_STACK_pop(BN_STACK *st)
      354.   	{
      355.   	return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:355:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `bn_probable_prime_dh_coprime` 
      353.   static unsigned int BN_STACK_pop(BN_STACK *st)
      354.   	{
      355.   	return st->indexes[--(st->depth)];
                     ^
      356.   	}
      357.   

static unsigned int BN_STACK_pop(BN_STACK *st)
	{
	return st->indexes[--(st->depth)];
	}
['int test_probable_prime_coprime(BIO *bp, BN_CTX *ctx)\n\t{\n\tint i, j, ret = 0;\n\tBIGNUM r;\n\tBN_ULONG primes[5] = { 2, 3, 5, 7, 11 };\n\tBN_init(&r);\n\tfor (i = 0; i < 1000; i++)\n\t\t{\n\t\tif (!bn_probable_prime_dh_coprime(&r, 1024, ctx)) goto err;\n\t\tfor (j = 0; j < 5; j++)\n\t\t\t{\n\t\t\tif (BN_mod_word(&r, primes[j]) == 0)\n\t\t\t\t{\n\t\t\t\tBIO_printf(bp, "Number generated is not coprime to %ld:\\n", primes[j]);\n\t\t\t\tBN_print_fp(stdout, &r);\n\t\t\t\tBIO_printf(bp, "\\n");\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tret = 1;\nerr:\n\tBN_clear(&r);\n\treturn ret;\n\t}', 'int bn_probable_prime_dh_coprime(BIGNUM *rnd, int bits, BN_CTX *ctx)\n\t{\n\tint i;\n\tBIGNUM *offset_index;\n\tBIGNUM *offset_count;\n\tint ret = 0;\n\tOPENSSL_assert(bits > prime_multiplier_bits);\n\tBN_CTX_start(ctx);\n\tif ((offset_index = BN_CTX_get(ctx)) == NULL) goto err;\n\tif ((offset_count = BN_CTX_get(ctx)) == NULL) goto err;\n\tBN_add_word(offset_count, prime_offset_count);\nloop:\n\tif (!BN_rand(rnd, bits - prime_multiplier_bits, 0, 1)) goto err;\n\tif (BN_is_bit_set(rnd, bits)) goto loop;\n\tif (!BN_rand_range(offset_index, offset_count)) goto err;\n\tBN_mul_word(rnd, prime_multiplier);\n\tBN_add_word(rnd, prime_offsets[BN_get_word(offset_index)]);\n\tfor (i = first_prime_index; i < NUMPRIMES; i++)\n\t\t{\n\t\tif (BN_mod_word(rnd, (BN_ULONG)primes[i]) <= 1)\n\t\t\t{\n\t\t\tgoto loop;\n\t\t\t}\n\t\t}\n\tret = 1;\nerr:\n\tBN_CTX_end(ctx);\n\tbn_check_top(rnd);\n\treturn ret;\n\t}', 'void BN_CTX_start(BN_CTX *ctx)\n\t{\n\tCTXDBG_ENTRY("BN_CTX_start", ctx);\n\tif(ctx->err_stack || ctx->too_many)\n\t\tctx->err_stack++;\n\telse if(!BN_STACK_push(&ctx->stack, ctx->used))\n\t\t{\n\t\tBNerr(BN_F_BN_CTX_START,BN_R_TOO_MANY_TEMPORARY_VARIABLES);\n\t\tctx->err_stack++;\n\t\t}\n\tCTXDBG_EXIT(ctx);\n\t}', 'void BN_CTX_end(BN_CTX *ctx)\n\t{\n\tCTXDBG_ENTRY("BN_CTX_end", ctx);\n\tif(ctx->err_stack)\n\t\tctx->err_stack--;\n\telse\n\t\t{\n\t\tunsigned int fp = BN_STACK_pop(&ctx->stack);\n\t\tif(fp < ctx->used)\n\t\t\tBN_POOL_release(&ctx->pool, ctx->used - fp);\n\t\tctx->used = fp;\n\t\tctx->too_many = 0;\n\t\t}\n\tCTXDBG_EXIT(ctx);\n\t}', 'static unsigned int BN_STACK_pop(BN_STACK *st)\n\t{\n\treturn st->indexes[--(st->depth)];\n\t}']