Skip to content

Fix stale fiber stack pointers across realloc#1751

Merged
bakpakin merged 1 commit into
janet-lang:masterfrom
iceghost:push-wlmmtumxkytp
May 14, 2026
Merged

Fix stale fiber stack pointers across realloc#1751
bakpakin merged 1 commit into
janet-lang:masterfrom
iceghost:push-wlmmtumxkytp

Conversation

@iceghost

Copy link
Copy Markdown
Contributor

Those cached pointers are not safe to use across Janet fiber operations, which may reallocate and invalidate those pointers.

Use the fields directly.


This fixes #1750 as well as one more location where stale fiber->data is used from my audit.

Codex was used to assist me in finding the invocations and flags to build and run Janet tests with ASAN, but the proposed fixes are all mine.

Those cached pointers are not safe to use across Janet fiber operations,
which may reallocate and invalidate those pointers.

Use the fields directly.
@bakpakin

Copy link
Copy Markdown
Member

Looks good to me! Thanks for the work here, as well as in #1750. I recently fixed similar issues in various places in vm.c, but I suppose we missed some. janet_eprintf and family did not used to be able to modify the stack, so the vm code overlooked it.

@bakpakin bakpakin merged commit 4413d43 into janet-lang:master May 14, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

heap-use-after-free in janet_dostring

2 participants