Skip to content
Memory corruption Disclosed report

Heap-use-after-free in nsWSAdmissionManager::OnStopSession

Abhishek Arya Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 5 days
  • Paid in 6 months
  • Disclosed after 5 days

Reproduces on trunk. 20120705010422 http://hg.mozilla.org/mozilla-central/rev/675f55c4310c

Flaky crash on mutation of testcase in bug 603750. Will update bug if i get a reliable testcase.

================================================================= ==2854== ERROR: AddressSanitizer heap-use-after-free on address 0x7fb1da389990 at pc 0x7fb1fc2ef86c bp 0x7fffcc052b70 sp 0x7fffcc052b68 READ of size 4 at 0x7fb1da389990 thread T0 #0 0x7fb1fc2ef86c in mozilla::net::nsWSAdmissionManager::OnStopSession(mozilla::net::WebSocketChannel*, unsigned int) netwerk/protocol/websocket/WebSocketChannel.cpp:376 #1 0x7fb1feeffda4 in NS_ProcessNextEvent_P(nsIThread*, bool) obj-firefox/xpcom/build/nsThreadUtils.cpp:217 #2 0x7fb1fec2a9f8 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) ipc/glue/MessagePump.cpp:82 #3 0x7fb1ff04202c in ~AutoRunState ipc/chromium/src/base/message_loop.cc:495 #4 0x7fb1fe977dde in nsBaseAppShell::Run() widget/xpwidgets/nsBaseAppShell.cpp:165 #5 0x7fb1fc00f4b1 in XREMain::XRE_main(int, char**, nsXREAppData const*) toolkit/xre/nsAppRunner.cpp:3863 #6 0x7fb1fc01050b in XRE_main toolkit/xre/nsAppRunner.cpp:3939 #7 0x408e83 in do_main(int, char**) browser/app/nsBrowserApp.cpp:160 #8 0x7fb204793c4d in __libc_start_main /build/buildd/eglibc-2.11.1/csu/libc-start.c:258 0x7fb1da389990 is located 272 bytes inside of 1840-byte region [0x7fb1da389880,0x7fb1da389fb0) freed by thread T0 here: #0 0x424442 in free #1 0x7fb1fc2d8dfe in mozilla::net::WebSocketChannel::Release() netwerk/protocol/websocket/WebSocketChannel.cpp:56 #2 0x7fb1fce70999 in nsWebSocket::Init(nsIPrincipal*, nsIScriptContext*, nsPIDOMWindow*, nsAString_internal const&, nsTArray<nsString, nsTArrayDefaultAllocator>&) content/base/src/nsWebSocket.cpp:1585 #3 0x7fb1fce6a2db in nsWebSocket::Initialize(nsISupports*, JSContext*, JSObject*, unsigned int, JS::Value*) content/base/src/nsWebSocket.cpp:694 #4 0x7fb1fd5449ed in nsCOMPtr<nsIWeakReference>::operator nsIWeakReference*() const dom/base/nsDOMClassInfo.cpp:5731 #5 0x7fb1fd5665b6 in non-virtual thunk to nsDOMConstructorSH::Construct(nsIXPConnectWrappedNative*, JSContext*, JSObject*, unsigned int, JS::Value*, JS::Value*, bool*) dom/base/nsDOMClassInfo.cpp:10642 #6 0x7fb1ffb4494b in js::CallJSNative(JSContext*, int ()(JSContext, unsigned int, JS::Value*), js::CallArgs const&) js/src/jscntxtinlines.h:400 #7 0x7fb1ffc0b1a7 in js::IndirectProxyHandler::construct(JSContext*, JSObject*, unsigned int, JS::Value*, JS::Value*) js/src/jsproxy.cpp:454 #8 0x7fb1ffd1e78b in js::DirectWrapper::construct(JSContext*, JSObject*, unsigned int, JS::Value*, JS::Value*) js/src/jswrapper.cpp:311 #9 0x7fb1ffd1ea8a in non-virtual thunk to js::CrossCompartmentWrapper::construct(JSContext*, JSObject*, unsigned int, JS::Value*, JS::Value*) #10 0x7fb1ffb4494b in js::CallJSNative(JSContext*, int ()(JSContext, unsigned int, JS::Value*), js::CallArgs const&) js/src/jscntxtinlines.h:400 #11 0x7fb1ffb189f0 in js::RunScript(JSContext*, JSScript*, js::StackFrame*) js/src/jsinterp.cpp:297 #12 0x7fb1ffb435d5 in js::InvokeKernel(JSContext*, js::CallArgs, js::MaybeConstruct) js/src/jsinterp.cpp:348 #13 0x7fb1ffb4466c in js::Invoke(JSContext*, js::InvokeArgsGuard&, js::MaybeConstruct) js/src/jsinterp.h:119 #14 0x7fb1ffa10f78 in JS_CallFunctionValue js/src/jsapi.cpp:5535 #15 0x7fb1fdf7e1d4 in nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS*, unsigned short, XPTMethodDescriptor const*, nsXPTCMiniVariant*) js/xpconnect/src/XPCWrappedJSClass.cpp:1436 #16 0x7fb1fdf70355 in nsXPCWrappedJS::CallMethod(unsigned short, XPTMethodDescriptor const*, nsXPTCMiniVariant*) js/xpconnect/src/XPCWrappedJS.cpp:580 #17 0x7fb1feff61a2 in PrepareAndDispatch xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp:121 #18 0x7fb1feff51e3 in SharedStub xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp:0 #19 0x7fb1fcfd539e in nsRefPtr<nsIDOMEventListener>::operator nsIDOMEventListener*() const content/events/src/nsEventListenerManager.cpp:818 #20 0x7fb1fd03579d in nsEventTargetChainItem::HandleEvent(nsEventChainPostVisitor&, unsigned int, bool, nsCxPusher*) content/events/src/nsEventListenerManager.h:143 previously allocated by thread T0 here: #0 0x424502 in __interceptor_malloc #1 0x7fb201c721a9 in moz_xmalloc memory/mozalloc/mozalloc.cpp:54 ==2854== ABORTING Stats: 137M malloced (165M for red zones) by 390620 calls Stats: 29M realloced by 14993 calls Stats: 92M freed by 149324 calls Stats: 0M really freed by 0 calls Stats: 340M (87089 full pages) mmaped in 85 calls mmaps by size class: 8:344043; 9:40955; 10:16380; 11:12282; 12:3072; 13:2560; 14:1536; 15:384; 16:640; 17:96; 18:160; 19:40; 20:16; mallocs by size class: 8:322499; 9:38213; 10:11968; 11:11008; 12:2251; 13:2092; 14:1423; 15:297; 16:597; 17:69; 18:151; 19:39; 20:13; frees by size class: 8:103752; 9:24604; 10:8113; 11:8045; 12:1486; 13:1215; 14:1201; 15:244; 16:531; 17:55; 18:30; 19:37; 20:11; rfrees by size class: Stats: malloc large: 272 small slow: 1874 Shadow byte and word: 0x1ff63b471332: fd 0x1ff63b471330: fd fd fd fd fd fd fd fd More shadow bytes: 0x1ff63b471310: fd fd fd fd fd fd fd fd 0x1ff63b471318: fd fd fd fd fd fd fd fd 0x1ff63b471320: fd fd fd fd fd fd fd fd 0x1ff63b471328: fd fd fd fd fd fd fd fd =>0x1ff63b471330: fd fd fd fd fd fd fd fd 0x1ff63b471338: fd fd fd fd fd fd fd fd 0x1ff63b471340: fd fd fd fd fd fd fd fd 0x1ff63b471348: fd fd fd fd fd fd fd fd 0x1ff63b471350: fd fd fd fd fd fd fd fd

The original report as published on Mozilla's Bugzilla, by Abhishek Arya. 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 critical-severity memory corruption bug in Networking. Mozilla made it public on 10 July 2012.

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 Abhishek Arya

View all

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