From d2d105b589594ef458421d3c4cf403ad9a024970 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Mon, 25 Jul 2022 14:45:41 +0900 Subject: [PATCH] bigint.c (mpz_get_int): should work with zero (i.e. `y->p == NULL`). --- mrbgems/mruby-bigint/core/bigint.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mrbgems/mruby-bigint/core/bigint.c b/mrbgems/mruby-bigint/core/bigint.c index 6da7b73b4..33167610f 100644 --- a/mrbgems/mruby-bigint/core/bigint.c +++ b/mrbgems/mruby-bigint/core/bigint.c @@ -721,6 +721,11 @@ mpz_get_str(mrb_state *mrb, char *s, mrb_int sz, mrb_int base, mpz_t *x) static int mpz_get_int(mpz_t *y, mrb_int *v) { + if (uzero(y)) { + *v = 0; + return TRUE; + } + mp_limb2 i = 0; mp_limb *d = y->p + y->sz;