Skip to content

Fix GC crash when a shape cannot grow its property table - #1975

Open
cognitivegears wants to merge 1 commit into
quickjs-ng:masterfrom
cognitivegears:fix-shape-resize-oom
Open

cognitivegears wants to merge 1 commit into
quickjs-ng:masterfrom
cognitivegears:fix-shape-resize-oom

Conversation

@cognitivegears

Copy link
Copy Markdown

When resize_properties() can't grow a shape's property table, js_realloc() throws while the shape is off gc_obj_list. Creating the error can run the GC, which then calls list_del() on the unlinked shape: a NULL write natively, list corruption on wasm32.

Reallocate with js_realloc_rt() and throw after relinking. TelegramMessenger/quickjs@fe1216f made the same fix; this adds a regression test that runs on master.

Refs #1917

(Drafted with AI assistance.)

When resize_properties() can't grow a shape's property table,
js_realloc() throws while the shape is off gc_obj_list. Creating the
error can run the GC, which then calls list_del() on the unlinked
shape.

Reallocate with js_realloc_rt() and throw after relinking.

Refs: quickjs-ng#1917

This branch has not been deployed

No deployments
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