Skip to content

Conversation

@coolreader18
Copy link
Contributor

I didn't realize this when I added these functions in #1785, but they use the same slotspace as {Get,Set}AlignedPointerInEmbedderData, so we need to offset them by INTERNAL_SLOT_COUNT and create the annex before setting them.

@coolreader18 coolreader18 force-pushed the fix-set_embedder_data branch from 4e2e9c9 to 9fdf040 Compare October 28, 2025 19:37
@bartlomieju bartlomieju requested a review from devsnek October 28, 2025 22:28
@coolreader18
Copy link
Contributor Author

Ping on this - it'd be nice to get this into a patch release.

@devsnek
Copy link
Member

devsnek commented Nov 5, 2025

can you add a test?

@coolreader18
Copy link
Contributor Author

In doing so I realized that the current set_aligned_pointer_in_embedder_data implementation is perhaps incorrect - the following code can cause a segfault:

static X: [u16; 2] = [1, 2];
unsafe { context.set_aligned_pointer_in_embedder_data(0, X.as_ptr() as _) };

because ANNEX_SLOT is 1 but INTERNAL_SLOT_COUNT is also 1. Should I fix that as well? Probably just by changing INTERNAL_SLOT_COUNT to 2?

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.

2 participants