Closed Bug 1764239 Opened 3 years ago Closed 3 years ago

Crash at js::ModuleObject::getCycleRoot

Categories

(Core :: JavaScript Engine, defect, P2)

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
104 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox-esr102 --- wontfix
firefox101 --- wontfix
firefox102 --- wontfix
firefox103 --- wontfix
firefox104 --- fixed

People

(Reporter: WeirdAl, Assigned: jonco)

References

(Blocks 2 open bugs)

Details

(Keywords: crash, testcase)

Attachments

(2 files)

Possible duplicate of bug 1754892, based on https://crash-stats.mozilla.org/report/index/feab810d-b832-483b-8f72-507020220412

I have a ClassReviver module which attempts to recreate objects from stringified JSON. I've written it so that in reviving, if a subclass of a base class misses some property, the reviver throws in calling defineClass().

Well, the subclass did miss a property. The defineClass() method threw... and MOZ_RELEASE_ASSERT(cycleRoot.isObject()); failed. ddd says cycleRoot = $JS::UndefinedValue().

Attached file bug1764239.tar.bz2

Steps to reproduce:

(In a completely empty directory)

  1. tar -xjf bug1764239.tar.bz2
  2. npm install --only=prod
  3. node playground.mjs
  4. In Firefox, load http://localhost:3030/fixtures/book-grid-editable.html

Expected result:
JavaScript error: http://localhost:3030/objects/ClassReviver.mjs, line 45: Error: Class doesn't have a static fromJSON() method?

Actual result:
Assertion failure: cycleRoot.isObject(), at /home/ajvincent/compiled/central/mozilla-central/js/src/builtin/ModuleObject.cpp:1128

Fixing the errors makes the crash go away.

Keywords: testcase
Severity: S2 → --
Group: core-security → javascript-core-security

Jon, Yulia, who might be the best person to look at this issue?

Also, knowing that this assertion is present in release builds, I wonder whether this crash should be considered as a security issue.

Severity: -- → S4
Flags: needinfo?(ystartsev)
Flags: needinfo?(jcoppeard)
Priority: -- → P2

(In reply to Nicolas B. Pierron [:nbp] from comment #3)

Also, knowing that this assertion is present in release builds, I wonder whether this crash should be considered as a security issue.

The only reason I marked it as such is that the bug this might be a duplicate of is also classified.

I'll give this the same rating as the other bug, then.

Keywords: sec-audit

I can reproduce this but I haven't managed to track it down yet. It's pretty strange that the cycle root is not set here.

Is there anything I can do to assist? I tried posting an absolute-minimum testcase, but that failed to reproduce the bug.

I can reproduce this failure with the following testcase:

let module1 = registerModule('module1', parseModule(
  `import {} from "module2";
   import {} from "module4";`));

let module2 = registerModule('module2', parseModule(
  `await import("module3");`));

let module3 = registerModule('module3', parseModule(
  ``));

let module4 = registerModule('module4', parseModule(
  `throw 1;`));

moduleLink(module1);

moduleEvaluate(module1);

drainJobQueue();
Assignee: nobody → jcoppeard
Flags: needinfo?(jcoppeard)

Like the changes in bug 1777972 concerning CycleRoot, this is not in the spec
but seems necessary due to the fact that this field isn't set when synchronous
module execution fails.

This is a release assert failure and is not a security vulnerability.

Group: javascript-core-security
Flags: needinfo?(ystartsev)
Keywords: sec-audit
Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a49298bd06fd Check for errors before accessing a module's CycleRoot field r=yulia
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: