Stale pointer in JSObject::TradeGuts()
Originally disclosed on Mozilla
- Fixed in 37 days
- Paid in 42 days
- Disclosed after 37 days
Created attachment 8444880 StalePointer_TradeGuts_Repro.html
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.84 Safari/537.36
Steps to reproduce:
Run the reproduction test case StalePointer_TradeGuts_Repro.html in Firefox browser.
Firefox Version: 32.0a1 (2014-05-20) Operating System: Windows 8, 64 bit
Actual results:
Firefox crashes in about 15 minutes by accessing an invalid pointer:
(3a5c.35ac): Access violation - code c0000005 (first chance) First chance exceptions are reported before any exception handling. This exception may be expected and handled. *** WARNING: Unable to verify checksum for D:\OpenSrcCode\firefox-central\obj-i686-pc-mingw32\dist\bin\mozjs.dll eax=20200000 ebx=1df28a80 ecx=1df28418 edx=1df28a98 esi=1df28400 edi=00000001 eip=6d1a74b5 esp=0022dc60 ebp=fe76bc2c iopl=0 nv up ei ng nz na po nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00210282 mozjs!JSObject::TradeGuts+0x165: 6d1a74b5 807d5500 cmp byte ptr [ebp+55h],0 ss:002b:fe76bc81=?? 0:000> !analyze -v
-
* -
Exception Analysis * -
*
*** WARNING: Unable to verify checksum for D:\OpenSrcCode\firefox-central\obj-i686-pc-mingw32\dist\bin\xul.dll *** WARNING: Unable to verify checksum for firefox.exe *** WARNING: Unable to verify checksum for D:\OpenSrcCode\firefox-central\obj-i686-pc-mingw32\dist\bin\nss3.dll
FAULTING_IP: mozjs!JSObject::TradeGuts+165 [d:\opensrccode\firefox-central\js\src\jsobj.cpp @ 2296] 6d1a74b5 807d5500 cmp byte ptr [ebp+55h],0
EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff) ExceptionAddress: 6d1a74b5 (mozjs!JSObject::TradeGuts+0x00000165) ExceptionCode: c0000005 (Access violation) ExceptionFlags: 00000000 NumberParameters: 2 Parameter[0]: 00000000 Parameter[1]: fe76bc81 Attempt to read from address fe76bc81
CONTEXT: 00000000 -- (.cxr 0x0;r) eax=20200000 ebx=1df28a80 ecx=1df28418 edx=1df28a98 esi=1df28400 edi=00000001 eip=6d1a74b5 esp=0022dc60 ebp=fe76bc2c iopl=0 nv up ei ng nz na po nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00210282 mozjs!JSObject::TradeGuts+0x165: 6d1a74b5 807d5500 cmp byte ptr [ebp+55h],0 ss:002b:fe76bc81=??
FAULTING_THREAD: 000035ac
DEFAULT_BUCKET_ID: INVALID_POINTER_READ
PROCESS_NAME: firefox.exe
ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%08lx referenced memory at 0x%08lx. The memory could not be %s.
EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%08lx referenced memory at 0x%08lx. The memory could not be %s.
EXCEPTION_PARAMETER1: 00000000
EXCEPTION_PARAMETER2: fe76bc81
READ_ADDRESS: fe76bc81
FOLLOWUP_IP: mozjs!JSObject::TradeGuts+165 [d:\opensrccode\firefox-central\js\src\jsobj.cpp @ 2296] 6d1a74b5 807d5500 cmp byte ptr [ebp+55h],0
NTGLOBALFLAG: 0
APPLICATION_VERIFIER_FLAGS: 0
APP: firefox.exe
ANALYSIS_VERSION: 6.3.9600.16384 (debuggers(dbg).130821-1623) x86fre
PRIMARY_PROBLEM_CLASS: INVALID_POINTER_READ
BUGCHECK_STR: APPLICATION_FAULT_INVALID_POINTER_READ
LAST_CONTROL_TRANSFER: from 6d1c97f4 to 6d1a74b5
STACK_TEXT:
0022dd30 6d1c97f4 0c687698 1df28400 1df28a80 mozjs!JSObject::TradeGuts+0x165
0022ddbc 6d15ee2d 0c687698 0022ddf8 0022deac mozjs!JSObject::swap+0x144
0022de2c 1045ceb8 192bcb90 0022de90 0022deac mozjs!JS_TransplantObject+0xfd
0022de64 103822f7 0c687698 0022de90 0022deac xul!xpc::TransplantObject+0x33
0022df40 10648e63 0c687698 0022df90 0022e0c0 xul!mozilla::dom::ReparentWrapper+0x469
0022dfd4 105de272 14721bb8 00000000 00000001 xul!nsNodeUtils::CloneAndAdopt+0x394
0022e004 105de64c 14721bb8 20264148 0022e058 xul!nsNodeUtils::Adopt+0x23
0022e0a8 105de2e1 14721bb8 0022e0c0 1e49d2d0 xul!nsIDocument::AdoptNode+0x336
0022e0d0 1063197d 1ffb3b80 14721c00 14721bb8 xul!nsDocument::AdoptNode+0x47
0022e0fc 1063eb40 00000000 14721bb8 0022e360 xul!AdoptNodeIntoOwnerDoc+0x7c
0022e2e4 1064e6fd 00000000 14721bb8 00000000 xul!nsINode::ReplaceOrInsertBefore+0x632
0022e320 10652f6c 1ee3d598 00000000 0022e3a4 xul!nsRange::InsertNode+0x1be
0022e344 102d4f82 00000000 1c4d6840 00000000 xul!nsRange::SurroundContents+0x15f
0022e378 10380655 0c687698 0022e3bc 1e575a10 xul!mozilla::dom::RangeBinding::surroundContents+0xcd
0022e3bc 6d22cd10 0c687698 00000001 1e575a10 xul!mozilla::dom::GenericBindingMethod+0x124
0022e5cc 6d22a02c 0c687698 07018180 00000001 mozjs!js::Invoke+0xf0
0022eca4 6d2305fe 0c687698 0022ecec 0c687698 mozjs!Interpret+0x508c
0022ecc8 6d22cdec 0c687698 0022ecec 0022f028 mozjs!js::RunScript+0x15e
0022eed4 6d22cbce 0c687698 0022ef40 00000000 mozjs!js::Invoke+0x1cc
0022ef70 6d155131 0c687698 0022f0ac 0022efe4 mozjs!js::Invoke+0x1de
0022ef94 1020b164 0c687698 0022f0ac 0022efe4 mozjs!JS::Call+0x21
0022f068 1049aedd 0022f1bc 0c687698 0022f0ac xul!mozilla::dom::Function::Call+0x19f
0022f178 104acdee 0022f1bc 0022f1a8 1e336814 xul!mozilla::dom::Function::Call<nsCOMPtr<nsISupports> >+0xea
0022f2a4 104acc0f 191ff538 0c628c88 0022f34c xul!nsGlobalWindow::RunTimeoutHandler+0xf4
0022f30c 104b50b5 191ff538 104b509d 0fcf83fb xul!nsGlobalWindow::RunTimeout+0x233
0022f318 0fcf83fb 18c73b80 191ff538 08965328 xul!nsGlobalWindow::TimerCallback+0x18
0022f358 0fcfa9d7 0fcf99e3 08965328 006aa410 xul!nsTimerImpl::Fire+0xd2
0022f35c 0fcf99e3 08965328 006aa410 006aa400 xul!nsTimerEvent::Run+0x14
0022f398 0fcc31e6 08965328 00000000 0022f3b7 xul!nsThread::ProcessNextEvent+0x1dd
0022f3ac 0fe696f8 012bcc10 00000000 002d9050 xul!NS_ProcessNextEvent+0x26
0022f3d8 0fe5cbda 002d9050 826539df 05b81ef8 xul!mozilla::ipc::MessagePump::Run+0x48
0022f410 0fe5c9d3 002bcc10 00000001 10e9ce00 xul!MessageLoop::RunHandler+0x54
0022f430 1040593c 05af5170 00000000 103e06c6 xul!MessageLoop::Run+0x19
0022f43c 103e06c6 05b81ef8 05af5170 6d3f4fa0 xul!nsBaseAppShell::Run+0x2a
0022f454 10b54a89 05b81ef8 0022f661 11027450 xul!nsAppShell::Run+0x75
0022f464 10b2d913 05af5170 71cf1408 0022f558 xul!nsAppStartup::Run+0x20
0022f53c 10b2c559 006a2b08 0022f6bc 00000001 xul!XREMain::XRE_mainRun+0x7fd
0022f558 10b2e0db 00000001 0068bae0 0022f6bc xul!XREMain::XRE_main+0x101
0022f668 01381854 00000001 0068bae0 0022f6bc xul!XRE_main+0x34
0022f7fc 01381494 00000001 0068bae0 006a29e8 firefox!do_main+0x272
0022f888 01381ae8 00000001 0068bae0 00000001 firefox!NS_internal_main+0x133
0022f8b8 0138245a 00000001 fffffe08 0068c0b8 firefox!wmain+0x10b
0022f8f8 7784338a fffde000 0022f944 77dc9f72 firefox!__tmainCRTStartup+0xfd
0022f904 77dc9f72 fffde000 6daecdb8 00000000 kernel32!BaseThreadInitThunk+0xe
0022f944 77dc9f45 013824c2 fffde000 00000000 ntdll!__RtlUserThreadStart+0x70
0022f95c 00000000 013824c2 fffde000 00000000 ntdll!_RtlUserThreadStart+0x1b
STACK_COMMAND: .cxr 0x0 ; kb
FAULTING_SOURCE_LINE: d:\opensrccode\firefox-central\js\src\jsobj.cpp
FAULTING_SOURCE_FILE: d:\opensrccode\firefox-central\js\src\jsobj.cpp
FAULTING_SOURCE_LINE_NUMBER: 2296
FAULTING_SOURCE_CODE:
2292: * Trigger post barriers for fixed slots. JSObject bits are barriered
2293: * below, in common with the other case.
2294: */
2295: for (size_t i = 0; i < a->numFixedSlots(); ++i) {
2296: HeapSlot::writeBarrierPost(a, HeapSlot::Slot, i, a->getSlot(i)); 2297: HeapSlot::writeBarrierPost(b, HeapSlot::Slot, i, b->getSlot(i)); 2298: } 2299: #endif 2300: } else { 2301: /*
SYMBOL_STACK_INDEX: 0
SYMBOL_NAME: mozjs!JSObject::TradeGuts+165
FOLLOWUP_NAME: MachineOwner
MODULE_NAME: mozjs
IMAGE_NAME: mozjs.dll
DEBUG_FLR_IMAGE_TIMESTAMP: 537a967e
FAILURE_BUCKET_ID: INVALID_POINTER_READ_c0000005_mozjs.dll!JSObject::TradeGuts
BUCKET_ID: APPLICATION_FAULT_INVALID_POINTER_READ_mozjs!JSObject::TradeGuts+165
ANALYSIS_SOURCE: UM
FAILURE_ID_HASH_STRING: um:invalid_pointer_read_c0000005_mozjs.dll!jsobject::tradeguts
FAILURE_ID_HASH: {f16df772-a140-e997-f5fb-70a6fa587c4c}
Followup: MachineOwner
Expected results:
Pointer should not be stale and of course Firefox should not crash.
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 31 July 2014.
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.