Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure next and orderedNext are null for slots in HashSlotMap. #1748

Merged

Conversation

aardvark179
Copy link
Contributor

Slot next and orderedNext in HashSlotMap

When an embedded slot map is promoted to being a HashSlotMap the slots are placed in the new map, but there next and orderedNext fields are not nulled, and nothing in the HashSlotMap code touches those fields. This can lead to slots holding on to an unexpected set of resources via the orderedNext chain which was built by EmbeddedSlotMap.

This PR copies the slots rather than reusing them, and sets the next and orderedNext fields to null on the copies, and sizes the linked hash map to match the number of slots being inserted on promotion to avoid unnecessary internal reallocations during this process.

@gbrail
Copy link
Collaborator

gbrail commented Dec 6, 2024

This is a great catch -- thanks for your thorough testing. I'll check it out and get to merging this soon.

@gbrail
Copy link
Collaborator

gbrail commented Dec 6, 2024

Thanks for fixing this!

@gbrail gbrail merged commit a8696c7 into mozilla:master Dec 6, 2024
3 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.

2 participants