Skip to content
Memory corruption Disclosed report Advanced

Assertion failure: comp == compartment || edgeIsInCrossCompartmentMap(thing), at gc/GC.cpp:2616

Gary Kwong Follow

Originally disclosed on Mozilla

  • Fixed in 9 days
  • Paid in 15 days
  • Disclosed after 9 days
Text
Created attachment 9525909
debug stack

'''js
fullcompartmentchecks(1);
var x = newGlobal({ newCompartment: true });
Debugger(x).onEnterFrame = function (y) {
  y.script.setBreakpoint(0, {});
};
x.eval("(function(){})()");
'''

'''
(gdb) bt
#0  0x0000555557d5d4ec in MOZ_CrashSequence (aAddress=0x0, aLine=2616)
    at /home/msf2/shell-cache/js-dbg-64-linux-x86_64-0a0abe40bbe8-595737/objdir-js/dist/include/mozilla/Assertions.h:237
#1  CompartmentCheckTracer::onChild (this=0x7fffffffcd18, thing=..., name=<optimized out>) at /home/msf2/trees/firefox/js/src/gc/GC.cpp:2616
#2  0x0000555557da8a8c in js::gc::TraceEdgeInternal (trc=0x7fffffffcd18, thingp=0x7ffff5e22618, Object=0x55555597c8d8 "breakpoint debugger object")
    at /home/msf2/trees/firefox/js/src/gc/Tracer.h:110
#3  js::TraceManuallyBarrieredCrossCompartmentEdge<JSObject*> (trc=trc@entry=0x7fffffffcd18, src=0x177ba9974078, dst=0x7ffff5e22618,
    name=name@entry=0x55555597c8d8 "breakpoint debugger object") at /home/msf2/trees/firefox/js/src/gc/Marking.cpp:509
#4  0x0000555557a4e5e9 in js::TraceCrossCompartmentEdge<js::NativeObject*> (trc=0x7fffffffcd18, src=0x0, dst=0x7ffff7804563 <_IO_2_1_stderr_+131>,
    name=0x55555597c8d8 "breakpoint debugger object") at /home/msf2/trees/firefox/js/src/gc/Tracer.h:367
#5  js::Breakpoint::trace (this=0x7ffff5e461c0, trc=0x7fffffffcd18) at /home/msf2/trees/firefox/js/src/debugger/Debugger.cpp:457
/snip
'''

'''
c528ae17f04f-594563
c528ae17f04fdcfa150e5c0ae819bbd15a8d6e3e is the first interesting commit
commit c528ae17f04fdcfa150e5c0ae819bbd15a8d6e3e
Author: Jon Coppeard
Date:   Mon Nov 3 17:23:14 2025 +0000

    Bug 1995637 - Make sure debugger object gets traced when tracing breakpoints r=iain

    Breakpoints currently trace |wrappedDebugger| but this doesn't keep |debugger|
    alive if we have nuked the CCWs. The debugger has a linked list of breakpoints that
    each breakpoint is part of so we need to make sure it lives at least as long as
    that.

    The patch traces the debugger's object even if our CCW to it has been nuked.

    Differential Revision: https://phabricator.services.mozilla.com/D271062
'''

Run with `--fuzzing-safe --no-threads --no-baseline --no-ion`, compile with `AR=ar sh ~/trees/firefox/js/src/configure --enable-debug --enable-debug-symbols --with-ccache --enable-nspr-build --enable-ctypes --enable-gczeal --enable-rust-simd --disable-tests`, tested on gh rev 0a0abe40bbe8cc587e6316541d7c59042fb9ae54.

Possible regressor bug 1995637 is marked s-s, Jon, is bug 1995637 a likely regressor?

(Because it's marked s-s, I cannot set it as possible regressor)

The original report as published on Mozilla's Bugzilla, by Gary Kwong. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is known

A medium-severity memory corruption bug in JavaScript: GC. Mozilla made it public on 19 November 2025.

About Memory corruption

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by Gary Kwong

View all

42 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.