From 5e6d3827823a668e0def4b4c919a0573a222fc35 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Mon, 30 Sep 2024 22:59:06 +0900 Subject: [PATCH] mruby-bigint (mpz_set_uint64): fixed a bug in for loop Found double increments in a loop. Since no one called mpz_set_int64() in the real code, we could not find this bug for long time. --- mrbgems/mruby-bigint/core/bigint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mrbgems/mruby-bigint/core/bigint.c b/mrbgems/mruby-bigint/core/bigint.c index dc680caa8..c8aca7905 100644 --- a/mrbgems/mruby-bigint/core/bigint.c +++ b/mrbgems/mruby-bigint/core/bigint.c @@ -101,7 +101,7 @@ mpz_set_uint64(mrb_state *mrb, mpz_t *y, uint64_t u) y->sn = (u != 0); mpz_realloc(mrb, y, len); for (size_t i=0; ip[i++] = (mp_limb)LOW(u); + y->p[i] = (mp_limb)LOW(u); u >>= DIG_SIZE; } }