From cd1260bb180dae6686a7059540e49ebe9f1b7543 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 13 Sep 2021 05:22:37 -0700 Subject: seq_iter: gc crash marking vector iterator. * lib.c (si_vec_ops): This must be initialized with seq_iter_ops_init_nomark, since it uses a cnum index, and not a val iter; the seq_iter_mark_op will pass the cnum bit pattern to gc_mark an cause a crash. (si_null_ops): While we are at it, this should also use seq_iter_ops_init_nomark, because it->ui.iter is always nil. --- lib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib.c b/lib.c index cb8bcde8..1a681c47 100644 --- a/lib.c +++ b/lib.c @@ -866,14 +866,14 @@ static void seq_iter_mark_op(struct seq_iter *it) gc_mark(it->ui.iter); } -struct seq_iter_ops si_null_ops = seq_iter_ops_init(seq_iter_get_nil, - seq_iter_peek_nil); +struct seq_iter_ops si_null_ops = seq_iter_ops_init_nomark(seq_iter_get_nil, + seq_iter_peek_nil); struct seq_iter_ops si_list_ops = seq_iter_ops_init(seq_iter_get_list, seq_iter_peek_list); -struct seq_iter_ops si_vec_ops = seq_iter_ops_init(seq_iter_get_vec, - seq_iter_peek_vec); +struct seq_iter_ops si_vec_ops = seq_iter_ops_init_nomark(seq_iter_get_vec, + seq_iter_peek_vec); struct seq_iter_ops si_hash_ops = seq_iter_ops_init(seq_iter_get_hash, seq_iter_peek_hash); -- cgit v1.2.3