Closed Bug 584334 Opened 16 years ago Closed 16 years ago

AsyncResolve should not be called with an empty host string

Categories

(Firefox :: Extension Compatibility, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: ma1)

Details

WARNING: NS_ENSURE_TRUE(host && *host) failed: file c:/build/mozilla-central/netwerk/dns/nsHostResolver.cpp, line 501 0:000> kp ChildEBP RetAddr 001db5f4 68ad752f xul!nsHostResolver::ResolveHost(char * host = 0x6aa8f27c "", unsigned short flags = 0, unsigned short af = 0, class nsResolveHostCallback * callback = 0x05b3e730)+0x16 [c:\build\mozilla-central\netwerk\dns\nshostresolver.cpp @ 501] 001db6c8 697db897 xul!nsDNSService::AsyncResolve(class nsACString_internal * hostname = 0x060597d0, unsigned int flags = 0, class nsIDNSListener * listener = 0x060652a0, class nsIEventTarget * target = 0x0137ba28, class nsICancelable ** result = 0x001db7d8)+0x2ff [c:\build\mozilla-central\netwerk\dns\nsdnsservice2.cpp @ 472] 001db6fc 69500df8 xul!NS_InvokeByIndex_P(class nsISupports * that = 0x020361c8, unsigned int methodIndex = 3, unsigned int paramCount = 5, struct nsXPTCVariant * params = 0x001db798)+0x27 [c:\build\mozilla-central\xpcom\reflect\xptcall\src\md\win32\xptcinvoke.cpp @ 103] 001db734 694ff01f xul!CallMethodHelper::Invoke(void)+0x58 [c:\build\mozilla-central\js\src\xpconnect\src\xpcwrappednative.cpp @ 3073] 001db748 694feda7 xul!CallMethodHelper::Call(void)+0xcf [c:\build\mozilla-central\js\src\xpconnect\src\xpcwrappednative.cpp @ 2340] 001db8d0 694e8157 xul!XPCWrappedNative::CallMethod(class XPCCallContext * ccx = 0x001db900, XPCWrappedNative::CallMode mode = CALL_METHOD (0n0))+0x217 [c:\build\mozilla-central\js\src\xpconnect\src\xpcwrappednative.cpp @ 2304] 001db998 6c415e54 xul!XPC_WN_CallMethod(struct JSContext * cx = 0x030da340, struct JSObject * obj = 0x01e76900, unsigned int argc = 4, union jsval_layout * argv = 0x02c30420, union jsval_layout * vp = 0x02c30488)+0x217 [c:\build\mozilla-central\js\src\xpconnect\src\xpcwrappednativejsops.cpp @ 1738] 001db9c0 6c415b9b mozjs!js::callJSNative(struct JSContext * cx = 0x030da340, <function> * native = 0x694e7f40, struct JSObject * thisobj = 0x01e76900, unsigned int argc = 4, class js::Value * argv = 0x02c30420, class js::Value * rval = 0x02c30488)+0x44 [c:\build\mozilla-central\js\src\jscntxtinlines.h @ 355] 001dba64 6c3f29fc mozjs!js::InvokeCommon<int (struct JSContext * cx = 0x030da340, struct JSFunction * fun = 0x01ef0900, struct JSScript * script = 0x00000000, <function> * native = 0x694e7f40, class js::InvokeArgsGuard * args = 0x001dbdc4, unsigned int flags = 2)+0x40b [c:\build\mozilla-central\js\src\jsinterp.cpp @ 577] 001dbab0 6c403cc0 mozjs!js::Invoke(struct JSContext * cx = 0x030da340, class js::InvokeArgsGuard * args = 0x001dbdc4, unsigned int flags = 2)+0x2bc [c:\build\mozilla-central\js\src\jsinterp.cpp @ 714] 001dcc20 6c415c11 mozjs!js::Interpret(struct JSContext * cx = 0x030da340)+0xded0 [c:\build\mozilla-central\js\src\jsinterp.cpp @ 4756] 001dccb0 6c3f29fc mozjs!js::InvokeCommon<int (struct JSContext * cx = 0x030da340, struct JSFunction * fun = 0x01eafea0, struct JSScript * script = 0x035a7780, <function> * native = 0x00000000, class js::InvokeArgsGuard * args = 0x001dd0dc, unsigned int flags = 0)+0x481 [c:\build\mozilla-central\js\src\jsinterp.cpp @ 588] 001dccfc 6c3f32c4 mozjs!js::Invoke(struct JSContext * cx = 0x030da340, class js::InvokeArgsGuard * args = 0x001dd0dc, unsigned int flags = 0)+0x2bc [c:\build\mozilla-central\js\src\jsinterp.cpp @ 714] 001dcd10 695ae411 mozjs!js::InvokeFriendAPI(struct JSContext * cx = 0x030da340, class js::InvokeArgsGuard * args = 0x001dd0dc, unsigned int flags = 0)+0x14 [c:\build\mozilla-central\js\src\jsinterp.cpp @ 737] 001dd0f4 695a74b1 xul!nsXPCWrappedJSClass::CallMethod(class nsXPCWrappedJS * wrapper = 0x03309410, unsigned short methodIndex = 3, struct XPTMethodDescriptor * info = 0x0140b8d8, struct nsXPTCMiniVariant * nativeParams = 0x001dd150)+0x11a1 [c:\build\mozilla-central\js\src\xpconnect\src\xpcwrappedjsclass.cpp @ 1692] 001dd114 697dbdd1 xul!nsXPCWrappedJS::CallMethod(unsigned short methodIndex = 3, struct XPTMethodDescriptor * info = 0x0140b8d8, struct nsXPTCMiniVariant * params = 0x001dd150)+0x41 [c:\build\mozilla-central\js\src\xpconnect\src\xpcwrappedjs.cpp @ 571] 001dd1f0 697dba96 xul!PrepareAndDispatch(class nsXPTCStubBase * self = 0x038382e0, unsigned int methodIndex = 3, unsigned int * args = 0x001dd218, unsigned int * stackBytesToPop = 0x001dd208)+0x321 [c:\build\mozilla-central\xpcom\reflect\xptcall\src\md\win32\xptcstubs.cpp @ 114] 001dd20c 697c5e46 xul!SharedStub(void)+0x16 [c:\build\mozilla-central\xpcom\reflect\xptcall\src\md\win32\xptcstubs.cpp @ 142] 001dd2dc 697c6091 xul!nsTimerImpl::Fire(void)+0x3a6 [c:\build\mozilla-central\xpcom\threads\nstimerimpl.cpp @ 429] 001dd308 697c96ba xul!nsTimerEvent::Run(void)+0xb1 [c:\build\mozilla-central\xpcom\threads\nstimerimpl.cpp @ 519] 001dd344 689b3bb3 xul!nsThread::ProcessNextEvent(int mayWait = 0n1, int * result = 0x001dd35c)+0x1fa [c:\build\mozilla-central\xpcom\threads\nsthread.cpp @ 547] 001dd360 6883f4bc xul!NS_ProcessNextEvent_P(class nsIThread * thread = 0x0137ba28, int mayWait = 0n1)+0x53 [c:\build\dbg-firefox-i686-pc-mingw32\xpcom\build\nsthreadutils.cpp @ 250] 001dd394 697f5876 xul!mozilla::ipc::MessagePump::Run(class base::MessagePump::Delegate * aDelegate = 0x0137b840)+0x1dc [c:\build\mozilla-central\ipc\glue\messagepump.cpp @ 142] 001dd3b8 697f57b2 xul!MessageLoop::RunInternal(void)+0x56 [c:\build\mozilla-central\ipc\chromium\src\base\message_loop.cc @ 220] 001dd3f0 697f5693 xul!MessageLoop::RunHandler(void)+0x82 [c:\build\mozilla-central\ipc\chromium\src\base\message_loop.cc @ 203] 001dd420 6972c960 xul!MessageLoop::Run(void)+0x43 [c:\build\mozilla-central\ipc\chromium\src\base\message_loop.cc @ 177] 001dd42c 696e3dc2 xul!nsBaseAppShell::Run(void)+0x50 [c:\build\mozilla-central\widget\src\xpwidgets\nsbaseappshell.cpp @ 181] 001df380 69657f4a xul!nsAppShell::Run(void)+0x42 [c:\build\mozilla-central\widget\src\windows\nsappshell.cpp @ 243] 001df394 684e022e xul!nsAppStartup::Run(void)+0x6a [c:\build\mozilla-central\toolkit\components\startup\src\nsappstartup.cpp @ 191] 001df9c0 00302532 xul!XRE_main(int argc = 0n1, char ** argv = 0x003de288, struct nsXREAppData * aAppData = 0x01374f58)+0x2c5e [c:\build\mozilla-central\toolkit\xre\nsapprunner.cpp @ 3647] 001dfa24 00301cce firefox!NS_internal_main(int argc = 0n1, char ** argv = 0x003de288)+0x2b2 [c:\build\mozilla-central\browser\app\nsbrowserapp.cpp @ 158] 001dfa58 003075cf firefox!wmain(int argc = 0n1, wchar_t ** argv = 0x003d4090)+0x11e [c:\build\mozilla-central\toolkit\xre\nswindowswmain.cpp @ 120] 001dfaa8 003073ff firefox!__tmainCRTStartup(void)+0x1bf [f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c @ 552] 001dfab0 760d1194 firefox!wmainCRTStartup(void)+0xf [f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c @ 371] 001dfabc 77a8b495 kernel32!BaseThreadInitThunk+0xe 001dfafc 77a8b468 ntdll!__RtlUserThreadStart+0x70 001dfb14 00000000 ntdll!_RtlUserThreadStart+0x1b 0:000> dv this = 0x013f41b8 host = 0x6aa8f27c "" flags = 0 af = 0 callback = 0x05b3e730 result = class nsRefPtr<nsHostRecord> status = 0x68ad7e49 rv = 0x1db6c0 0 [native frame] 1 anonymous() ["chrome://noscript/content/DNS.js":238] this = [object BackstagePass @ 0x20b3488 (native @ 0x30d6b6c)] 2 anonymous(self = undefined, callback = [function]) ["chrome://noscript/content/Thread.js":19] thread = [xpconnect wrapped (nsISupports, nsIThread, nsIThreadInternal, nsIEventTarget, nsISupportsPriority) @ 0x5f76db0 (native @ 0x137ba28)] this = [object Object] 3 anonymous(callback = undefined, flags = 0, host = "") ["chrome://noscript/content/DNS.js":249] resolve = [function] status = 0 ctrl = [object Object] resolving = [object Object] dnsRecord = false async = true cache = [object Object] t = undefined elapsed = 0 this = [object Object] 4 anonymous(dontResolve = undefined, all = undefined, host = "") ["chrome://noscript/content/DNS.js":318] res = undefined this = [object Object] 5 anonymous(noproxy = true, url = "https://secure.informaction.com/ipecho/") ["chrome://noscript/content/DNS.js":482] proxyInfo = [xpconnect wrapped nsIProxyInfo @ 0x5f80608 (native @ 0x5fff9a0)] ch = [xpconnect wrapped (nsISupports, nsIChannel, nsIProxiedChannel) @ 0x5f836c8 (native @ 0x62172e8)] xhr = [object XMLHttpRequest @ 0x5f78f00 (native @ 0x61fcfe8)] this = [object Object] 6 anonymous(callback = [function]) ["chrome://noscript/content/DNS.js":506] xhr = undefined sent = false this = [object Object] 7 anonymous(forceFind = undefined) ["chrome://noscript/content/DNS.js":421] t = 1280925955244 this = [object Object] 8 anonymous([xpconnect wrapped nsITimer @ 0x33093a8 (native @ 0x3728a10)]) ["chrome://noscript/content/DNS.js":391] this = [object Object] DNS.js var resolve = function() { DNS._dns.asyncResolve(host, flags, new DNSListener(function() { if (DNS.logEnabled) DNS.log("Async " + host); cache.put(host, dnsRecord = new DNSRecord(this.record)); ctrl.running = false; var callbacks = resolving[host]; delete resolving[host]; if (ABE.consoleDump && t) { elapsed = Date.now() - t; ABE.log("Async DNS query on " + host + " done, " + elapsed + "ms, callbacks: " + (callbacks && callbacks.length)); } if (callbacks && callbacks.length) for each(var cb in callbacks) cb(dnsRecord); }), Thread.currentQueue); // this is line 238 if (ABE.consoleDump) ABE.log("Waiting for DNS query on " + host); if (!callback) Thread.spin(ctrl); }
Repeated again to get 5 anonymous(noproxy = true, url = "https://secure.informaction.com/ipecho/") ["chrome://noscript/content/DNS.js":482] proxyInfo = [xpconnect wrapped nsIProxyInfo @ 0x5f7bd50 (native @ 0x6329038)] 0:000> dt 0x6329038 nsProxyInfo mHost.mData xul!nsProxyInfo +0x010 mHost : +0x000 mData : 0x6aa8f27c "" 0:000> dt 0x6329038 nsProxyInfo mHost.mLength xul!nsProxyInfo +0x010 mHost : +0x004 mLength : 0 0:000> dt 0x6329038 nsProxyInfo mType xul!nsProxyInfo +0x00c mType : 0x6a148474 "unknown" So, when your nsIProxyInfo type is "unknown", you can't assume that mHost isn't empty. When it's empty, please don't pass that to AsyncResolve :)
OK, thanks for the full analysis -- in practice, you fixed the bug by yourself :)
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.