From 89ca842dcce7f05942e2d7be3edc404c9556cafd Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 2 Oct 2020 10:57:07 +0900 Subject: Ensure that the comparison succeeded [Bug #17205] --- numeric.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'numeric.c') diff --git a/numeric.c b/numeric.c index 6d4eb86b1a..a767c12bf8 100644 --- a/numeric.c +++ b/numeric.c @@ -1518,7 +1518,9 @@ flo_cmp(VALUE x, VALUE y) MJIT_FUNC_EXPORTED int rb_float_cmp(VALUE x, VALUE y) { - return NUM2INT(flo_cmp(x, y)); + VALUE c = flo_cmp(x, y); + if (NIL_P(c)) rb_cmperr(x, y); + return NUM2INT(c); } /* -- cgit v1.2.1