From e03c9286aaca1a8e94ef482e4de5db7055b1edbb Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Mon, 5 Aug 2019 13:07:41 -0700 Subject: [PATCH] replaces road stack sanity assertions with explicit bail:meme --- pkg/urbit/jets/e/cue.c | 8 ++++++-- pkg/urbit/noun/allocate.c | 18 ++++++++++++++---- pkg/urbit/noun/retrieve.c | 8 ++++++-- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/pkg/urbit/jets/e/cue.c b/pkg/urbit/jets/e/cue.c index 488cf02262..e2ad709981 100644 --- a/pkg/urbit/jets/e/cue.c +++ b/pkg/urbit/jets/e/cue.c @@ -38,10 +38,14 @@ _cue_push(c3_ys mov, // (off==0 means we're on a north road) // if ( 0 == off ) { - c3_assert(u3R->cap_p > u3R->hat_p); + if( !(u3R->cap_p > u3R->hat_p) ) { + u3m_bail(c3__meme); + } } else { - c3_assert(u3R->cap_p < u3R->hat_p); + if( !(u3R->cap_p < u3R->hat_p) ) { + u3m_bail(c3__meme); + } } cueframe* fam_u = u3to(cueframe, u3R->cap_p + off); diff --git a/pkg/urbit/noun/allocate.c b/pkg/urbit/noun/allocate.c index 1a1476b295..299f5bc601 100644 --- a/pkg/urbit/noun/allocate.c +++ b/pkg/urbit/noun/allocate.c @@ -586,8 +586,13 @@ u3a_push(c3_w len_w) top -= len_w; cur = top; u3p(void) cap_p = u3R->cap_p = u3of(void, top); - c3_assert(cap_p < u3R->mat_p); - c3_assert(cap_p > u3R->hat_p); + + if( !( cap_p < u3R->mat_p && + cap_p > u3R->hat_p ) ) + { + u3m_bail(c3__meme); + } + return cur; } else { @@ -595,8 +600,13 @@ u3a_push(c3_w len_w) top += len_w; u3R->cap_p = u3of(void, top); u3p(void) cap_p = u3R->cap_p = u3of(void, top); - c3_assert(cap_p > u3R->mat_p); - c3_assert(cap_p < u3R->hat_p); + + if( !( cap_p > u3R->mat_p && + cap_p < u3R->hat_p ) ) + { + u3m_bail(c3__meme); + } + return cur; } } diff --git a/pkg/urbit/noun/retrieve.c b/pkg/urbit/noun/retrieve.c index f2a653264c..42dc35dbf3 100644 --- a/pkg/urbit/noun/retrieve.c +++ b/pkg/urbit/noun/retrieve.c @@ -1597,10 +1597,14 @@ _mug_push(c3_ys mov, // (off==0 means we're on a north road) // if ( 0 == off ) { - c3_assert(u3R->cap_p > u3R->hat_p); + if( !(u3R->cap_p > u3R->hat_p) ) { + u3m_bail(c3__meme); + } } else { - c3_assert(u3R->cap_p < u3R->hat_p); + if( !(u3R->cap_p < u3R->hat_p) ) { + u3m_bail(c3__meme); + } } mugframe* fam_u = u3to(mugframe, u3R->cap_p + off);