From a208440c4f603f3b3d7e0013674985dd95da0b34 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 19 Feb 2026 20:31:45 +0900 Subject: [PATCH] numeric.c: fix SEGV in int_divmod when argument is not numeric int_divmod passed an integer mrb_value directly to flo_divmod, which used mrb_float() to extract the value. In word boxing mode, this caused a misaligned pointer dereference. Use mrb_ensure_float_type() to safely convert the integer to float before passing to flo_divmod. Co-authored-by: Claude --- src/numeric.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/numeric.c b/src/numeric.c index daca05ace..7f6cb7451 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -1263,7 +1263,7 @@ int_divmod(mrb_state *mrb, mrb_value x) #ifdef MRB_NO_FLOAT mrb_raise(mrb, E_TYPE_ERROR, "non integer divmod"); #else - return flo_divmod(mrb, x); + return flo_divmod(mrb, mrb_ensure_float_type(mrb, x)); #endif }