diff options
author | Yuichiro Kaneko <[email protected]> | 2023-10-01 23:46:19 +0900 |
---|---|---|
committer | Yuichiro Kaneko <[email protected]> | 2023-10-02 09:41:45 +0900 |
commit | 1ed6fd899769e6cd66a1a3f66b7818d48ba4231b (patch) | |
tree | b5873253ad214e2f150f148f60941616ac1c8139 /compile.c | |
parent | 81668579ed0cf90b95f2fcc5755b51842fb65917 (diff) |
Check the result of get_nd_recv before node type check for safety
Co-authored-by: Nobuyoshi Nakada <[email protected]>
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -5420,9 +5420,9 @@ compile_cpath(LINK_ANCHOR *const ret, rb_iseq_t *iseq, const NODE *cpath) static inline int private_recv_p(const NODE *node) { - if (nd_type_p(get_nd_recv(node), NODE_SELF)) { - NODE *self = get_nd_recv(node); - return RNODE_SELF(self)->nd_state != 0; + NODE *recv = get_nd_recv(node); + if (recv && nd_type_p(recv, NODE_SELF)) { + return RNODE_SELF(recv)->nd_state != 0; } return 0; } |