Skip to content

Commit

Permalink
Validate tag type to jump
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Mar 17, 2024
1 parent e69708e commit a91800c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions eval_intern.h
Expand Up @@ -145,15 +145,16 @@ rb_ec_tag_state(const rb_execution_context_t *ec)
enum ruby_tag_type state = tag->state;
tag->state = TAG_NONE;
rb_ec_vm_lock_rec_check(ec, tag->lock_rec);
RBIMPL_ASSUME(state != TAG_NONE);
RBIMPL_ASSUME(state > TAG_NONE);
RBIMPL_ASSUME(state <= TAG_FATAL);
return state;
}

NORETURN(static inline void rb_ec_tag_jump(const rb_execution_context_t *ec, enum ruby_tag_type st));
static inline void
rb_ec_tag_jump(const rb_execution_context_t *ec, enum ruby_tag_type st)
{
RUBY_ASSERT(st != TAG_NONE);
RUBY_ASSERT(st > TAG_NONE && st <= TAG_FATAL, ": Invalid tag jump: %d", (int)st);
ec->tag->state = st;
ruby_longjmp(RB_VM_TAG_JMPBUF_GET(ec->tag->buf), 1);
}
Expand Down

0 comments on commit a91800c

Please sign in to comment.