From a91800c4a05cc573a0ed1607210fc360a5c16b57 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 8 Aug 2023 00:28:36 +0900 Subject: [PATCH] Validate tag type to jump --- eval_intern.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eval_intern.h b/eval_intern.h index 4ea23068bb..aac72e172c 100644 --- a/eval_intern.h +++ b/eval_intern.h @@ -145,7 +145,8 @@ 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; } @@ -153,7 +154,7 @@ NORETURN(static inline void rb_ec_tag_jump(const rb_execution_context_t *ec, enu 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); }