Skip to content

Commit

Permalink
Fix off-by-one with RubyVM::Shape.exhaust_shapes
Browse files Browse the repository at this point in the history
Previously, the method left one shape available (MAX_SHAPE_ID) when
called without arguments.
  • Loading branch information
XrXr committed Nov 22, 2023
1 parent 9414480 commit 7ecaee0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion shape.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 7ecaee0

Please sign in to comment.