mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-21 05:41:43 +03:00
adds assertions to protect u3r_mug against stack overflow
This commit is contained in:
parent
76fa248700
commit
e655b07ecb
@ -1603,6 +1603,17 @@ static inline mugframe*
|
||||
_mug_push(c3_ys mov, c3_ys off, u3_noun veb)
|
||||
{
|
||||
u3R->cap_p += mov;
|
||||
|
||||
// ensure we haven't overflowed the stack
|
||||
// (off==0 means we're on a north road)
|
||||
//
|
||||
if ( 0 == off ) {
|
||||
c3_assert(u3R->cap_p > u3R->hat_p);
|
||||
}
|
||||
else {
|
||||
c3_assert(u3R->cap_p < u3R->hat_p);
|
||||
}
|
||||
|
||||
mugframe* cur = u3to(mugframe, u3R->cap_p + off);
|
||||
cur->veb = veb;
|
||||
cur->a = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user