Fix intermediate array off-by-one error

Co-authored-by: Adam Hess <HParker@github.com>
This commit is contained in:
Kevin Newton 2024-10-04 13:57:14 -04:00
parent f77517f473
commit 30038656aa
Notes: git 2024-10-04 19:04:43 +00:00
3 changed files with 53 additions and 5 deletions

View file

@ -6797,6 +6797,8 @@ pm_compile_array_node(rb_iseq_t *iseq, const pm_node_t *node, const pm_node_list
// Create the temporary array.
for (; tmp_array_size; tmp_array_size--)
rb_ary_push(tmp_array, pm_static_literal_value(iseq, elements->nodes[index++], scope_node));
index--; // about to be incremented by for loop
OBJ_FREEZE(tmp_array);
// Emit the optimized code.