From 7ecaee0211a1463fafe22e9dcaf3587a43c0a448 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Wed, 22 Nov 2023 11:35:42 -0500 Subject: [PATCH] Fix off-by-one with RubyVM::Shape.exhaust_shapes Previously, the method left one shape available (MAX_SHAPE_ID) when called without arguments. --- shape.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shape.c b/shape.c index de57551fcf1d81..6d6235dd3d546c 100644 --- a/shape.c +++ b/shape.c @@ -1062,7 +1062,7 @@ rb_shape_exhaust(int argc, VALUE *argv, VALUE self) { rb_check_arity(argc, 0, 1); int offset = argc == 1 ? NUM2INT(argv[0]) : 0; - GET_SHAPE_TREE()->next_shape_id = MAX_SHAPE_ID - offset; + GET_SHAPE_TREE()->next_shape_id = MAX_SHAPE_ID - offset + 1; return Qnil; }