Skip to content

fix: Fix decompressed bundled source use after free#212

Merged
Benjamin-Dobell merged 1 commit into
godotjs:mainfrom
Benjamin-Dobell:fix/bundled-source-use-after-free
Apr 20, 2026
Merged

fix: Fix decompressed bundled source use after free#212
Benjamin-Dobell merged 1 commit into
godotjs:mainfrom
Benjamin-Dobell:fix/bundled-source-use-after-free

Conversation

@Benjamin-Dobell
Copy link
Copy Markdown
Member

This caused an intermittent failures e.g. https://github.com/godotjs/GodotJS/actions/runs/24649141103/job/72067918791.

I didn't review the history, but judging by how the code is written I suspect the data was not initially compressed, so the static data pointers were valid indefinitely (pointer to read-only load data in the executable). However, since the data is now decompressed, the data's lifetime is tied to lifetime of the PresetSource. It's stack allocated, so when it goes out of scope it's destroyed. Looks like we'd been getting lucky most of the time and nothing was writing to the now freed address range - but not so in that GHA run. Glad this was caught!

@Benjamin-Dobell Benjamin-Dobell merged commit aff8c46 into godotjs:main Apr 20, 2026
28 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.

1 participant