Repository navigation
Do not leak the old prototype in JS_AddIntrinsicDOMException() - #1642
Merged
saghul merged 2 commits intoAug 20, 2026
Merged
Conversation
JS_AddIntrinsicDOMException() overwrites ctx->class_proto[] with a plain assignment. The slot is initialised to JS_NULL by JS_NewContext(), so a single call is harmless, but a second call on the same context drops the reference to the prototype installed by the first one and leaks it. Use set_value(), like every other class_proto[] store in the file. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014mv33YvfHz7t9mmkituBnn
JS_NewContext() already installs DOMException through JS_AddIntrinsicAToB(), so a host that also calls JS_AddIntrinsicDOMException() installs it twice. The test installs it several more times and lets new_runtime()'s JS_ABORT_ON_LEAKS catch the prototype the old code dropped on the floor, then checks that the class prototype still matches the global constructor and that internally thrown DOMExceptions use it too. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01K6eRbuuuCujKgQkrHgvMrc
saghul
approved these changes
Aug 20, 2026
social4hyq
pushed a commit
to social4hyq/homebrew-core
that referenced
this pull request
Sep 20, 2026
quickjs-ng 0.16.2 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## What's Changed * Fix JS_NewObjectFrom by @bnoordhuis in quickjs-ng/quickjs#1659 * Fix Proxy ownKeys trap accepting a primitive result by @saghul in quickjs-ng/quickjs#1637 * Fix arity of os.chdir and std.setenv by @bnoordhuis in quickjs-ng/quickjs#1662 * Fix object leak in JS_NewCConstructor by @bnoordhuis in quickjs-ng/quickjs#1670 * Fix SIGBUS on strict-alignment platforms: align cpool_offset to 8 bytes by @vom513 in quickjs-ng/quickjs#1666 * Fix TypedArray.prototype.with() value conversion order by @sr5434 in quickjs-ng/quickjs#1667 * Do not leak the old prototype in JS_AddIntrinsicDOMException() by @andreasrosdal in quickjs-ng/quickjs#1642 * Return the class name atom from JS_GetClassName() by @andreasrosdal in quickjs-ng/quickjs#1641 * Always call the sort comparator, even for identical values by @andreasrosdal in quickjs-ng/quickjs#1645 * Fix rejection of escaped reserved punctuators in v-flag \q by @sr5434 in quickjs-ng/quickjs#1671 * Add interrupt checks to Array prototype methods by @bnoordhuis in quickjs-ng/quickjs#1674 * Propagate exceptions from the get/set descriptor accessors by @saghul in quickjs-ng/quickjs#1638 * Check target extensibility via IsExtensible() in the proxy invariant checks by @saghul in quickjs-ng/quickjs#1636 ## New Contributors * @vom513 made their first contribution in quickjs-ng/quickjs#1666 * @sr5434 made their first contribution in quickjs-ng/quickjs#1667 **Full Changelog**: https://github.com/quickjs-ng/quickjs/compare/v0.16.1...v0.16.2</pre> <p>View the full release notes at <a href="https://github.com/quickjs-ng/quickjs/releases/tag/v0.16.2">https://github.com/quickjs-ng/quickjs/releases/tag/v0.16.2</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!17324
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JS_AddIntrinsicDOMException()overwritesctx->class_proto[JS_CLASS_DOM_EXCEPTION]with a plain assignment. The slot is initialised toJS_NULLbyJS_NewContext(), so a single call is harmless, but a second call on the same context drops the reference to the prototype installed by the first one and leaks it.Use
set_value(), like every otherclass_proto[]store in the file.🤖 Generated with Claude Code
https://claude.ai/code/session_014mv33YvfHz7t9mmkituBnn
Generated by Claude Code