Initialize node_id

In some causes node_id might have been left uninitialized leading to
undefined behavior on access. So always set it to -1, so we have *some*
valid value in there.
This commit is contained in:
Wolf 2022-07-29 20:12:39 +02:00 committed by Yusuke Endoh
parent 3b8279e91f
commit c69ad738dc
Notes: git 2022-08-01 10:37:07 +09:00

1
node.c
View File

@ -1138,6 +1138,7 @@ rb_node_init(NODE *n, enum node_type type, VALUE a0, VALUE a1, VALUE a2)
n->nd_loc.beg_pos.column = 0; n->nd_loc.beg_pos.column = 0;
n->nd_loc.end_pos.lineno = 0; n->nd_loc.end_pos.lineno = 0;
n->nd_loc.end_pos.column = 0; n->nd_loc.end_pos.column = 0;
n->node_id = -1;
} }
typedef struct node_buffer_elem_struct { typedef struct node_buffer_elem_struct {