Skip to content

Always run atexit on the top-level call frame#6276

Merged
matz merged 1 commit intomruby:masterfrom
dearblue:closing
May 27, 2024
Merged

Always run atexit on the top-level call frame#6276
matz merged 1 commit intomruby:masterfrom
dearblue:closing

Conversation

@dearblue
Copy link
Copy Markdown
Contributor

In the following example, the fiber context and call stack may be in an incomplete state.

  • In case another thread running mruby is terminated abnormally
  • In case of a global jump that is out of management by mruby

In the following example, the fiber context and call stack may be in an incomplete state.
  - In case another thread running mruby is terminated abnormally
  - In case of a global jump that is out of management by mruby
@dearblue dearblue requested a review from matz as a code owner May 26, 2024 14:29
@github-actions github-actions Bot added the core label May 26, 2024
@matz matz merged commit f2dc442 into mruby:master May 27, 2024
@dearblue
Copy link
Copy Markdown
Contributor Author

dearblue commented Jun 3, 2024

I should have done MRB_ENV_CLOSE(ci->e->env) with ci->env->stack of incomplete ci set to NULL.
I will send a corrected PR in the near future.

dearblue added a commit to dearblue/mruby that referenced this pull request Jun 6, 2024
Supplement to commit 177deba (mruby#6276).

If the ci is incomplete, the previous method may cause the application to crash because `env->stack` points to an invalid address when expanding the data stack.
Since the ci is in an abnormal state, control it by putting `NULL` in `env->stack`.

If the ci is fine and top-level, detach `env` as usual with `mrb_env_unshare()`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants