diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-10-02 23:58:02 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-10-02 23:58:02 +0200 |
commit | 2c3e8f8e38fa2bb07519ca60d5b5efdf234aef32 (patch) | |
tree | fc633fcc9680e7715610aa3d7bd6d4c0bbfc0124 | |
parent | d69fe00baba5f262dd0008ba01a4d4fa09c424a8 (diff) |
eval: avoid null pointer access in ut_invoke()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | eval.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -1069,7 +1069,9 @@ ut_invoke(struct ut_state *state, uint32_t off, struct json_object *scope, /* store the function "this" context in the proto member of the scope tag structure */ tag = json_object_get_userdata(s); - tag->tag.proto = json_object_get(state->ctx); + + if (tag) + tag->tag.proto = json_object_get(state->ctx); rv = ut_execute_op_sequence(state, decl->tree.operand[2]); tag = json_object_get_userdata(rv); @@ -1097,8 +1099,11 @@ ut_invoke(struct ut_state *state, uint32_t off, struct json_object *scope, /* we left the function, remove the "this" context from the scope tag structure */ tag = json_object_get_userdata(s); - json_object_put(tag->tag.proto); - tag->tag.proto = NULL; + + if (tag) { + json_object_put(tag->tag.proto); + tag->tag.proto = NULL; + } if (!scope) { state->stack.scope[--state->stack.off] = NULL; |