Skip to content

Commit

Permalink
fix nock 9 crashing pier if axis is cell (#661)
Browse files Browse the repository at this point in the history
Solves #660 

Prevents Nock 9 from crashing the pier if the axis argument is a cell.
Without the check Vere may call `u3qc_cap` on a cell, leading to a
segfault or an assertion failure:

```
Assertion '_(u3a_is_atom(b))' failed in pkg/noun/retrieve.c:1011
```

To reproduce the bug, run in Dojo:

```
.*(0 [9 [2 2] 0 1])
```

Is there a way to add a unit test to guard against a downgrade?
  • Loading branch information
pkova authored Jun 24, 2024
2 parents b3b7c14 + 55eb485 commit 36900c5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/noun/nock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ _n_comp(u3_noun* ops, u3_noun fol, c3_o los_o, c3_o tel_o)

case 9:
u3x_cell(arg, &hed, &tel);
if ( (1 == hed) || (3 == u3qc_cap(hed)) ) {
if ( (1 == hed) || (3 == u3qc_cap(u3x_atom(hed))) ) {
u3_noun mac = u3nq(7, u3k(tel), 2, u3nt(u3nc(0, 1), 0, u3k(hed)));
tot_w += _n_comp(ops, mac, los_o, tel_o);
u3z(mac);
Expand Down

0 comments on commit 36900c5

Please sign in to comment.