Closed Bug 283429 Opened 19 years ago Closed 19 years ago

javascript undefined object -> crash in nsIProcess::Init

Categories

(Core :: XPCOM, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bugzilla.20.scyt, Assigned: timeless)

Details

Attachments

(1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113
Build Identifier: Mozilla XULRunner 1.8b 0000000000

I have written a small xul application and want to start an external process. I
use the following code snippet to initialize an object that supports the
nsIProcess interface.

001    var dxdiag_exe;
002    var dxdiag_process = Components.classes["@mozilla.org/process/util;1"]
003             .createInstance(Components.interfaces.nsIProcess);
004    dxdiag_process.init( dxdiag_exe );

As you can see dxdiag_exe is undefined in the call to dxdiag_process.init()
(line 004).

Reproducible: Always

Steps to Reproduce:
Run the mentioned script.
Actual Results:  
Crash in nsProcess::Init(nsIFile* executable) / nsprocesscommon.cpp:89
executable == NULL.

084    nsProcess::Init(nsIFile* executable)
085    {
086        PRBool isFile;
087    
089        //First make sure the file exists
090        nsresult rv = executable->IsFile(&isFile);
091        if (NS_FAILED(rv)) return rv;

callstack:
>	xul.dll!nsProcess::Init(nsIFile * executable=0x00000000)  Line 89 + 0x7	C++
 	xul.dll!XPTC_InvokeByIndex(nsISupports * that=0x0245c3e8, unsigned int
methodIndex=3, unsigned int paramCount=1, nsXPTCVariant * params=0x0012ad5c) 
Line 102	C++
 	xul.dll!XPCWrappedNative::CallMethod(XPCCallContext & ccx={...},
XPCWrappedNative::CallMode mode=CALL_METHOD)  Line 2034 + 0x1d	C++
 	xul.dll!XPC_WN_CallMethod(JSContext * cx=0x02432f70, JSObject *
obj=0x02513338, unsigned int argc=1, long * argv=0x0273c204, long *
vp=0x0012b030)  Line 1287 + 0xe	C++
 	js3250.dll!js_Invoke(JSContext * cx=0x02432f70, unsigned int argc=1, unsigned
int flags=0)  Line 1293 + 0x20	C
 	js3250.dll!js_Interpret(JSContext * cx=0x02432f70, unsigned char *
pc=0x0249b0fb, long * result=0x0012bb78)  Line 3563 + 0xf	C
 	js3250.dll!js_Invoke(JSContext * cx=0x02432f70, unsigned int argc=1, unsigned
int flags=6)  Line 1313 + 0x13	C
 	js3250.dll!fun_apply(JSContext * cx=0x02432f70, JSObject * obj=0x02512d10,
unsigned int argc=1, long * argv=0x0273c150, long * rval=0x0012bc88)  Line
1544 + 0xf	C
 	js3250.dll!js_Invoke(JSContext * cx=0x02432f70, unsigned int argc=2, unsigned
int flags=0)  Line 1293 + 0x20	C
 	js3250.dll!js_Interpret(JSContext * cx=0x02432f70, unsigned char *
pc=0x024f4d47, long * result=0x0012c7d0)  Line 3563 + 0xf	C
 	js3250.dll!js_Invoke(JSContext * cx=0x02432f70, unsigned int argc=1, unsigned
int flags=2)  Line 1313 + 0x13	C
 	js3250.dll!js_InternalInvoke(JSContext * cx=0x02432f70, JSObject *
obj=0x02454fc0, long fval=38096992, unsigned int flags=0, unsigned int argc=1,
long * argv=0x0012d300, long * rval=0x0012d300)  Line 1390 + 0x14	C
 	js3250.dll!js_InternalGetOrSet(JSContext * cx=0x02432f70, JSObject *
obj=0x02454fc0, long id=38658944, long fval=38096992, JSAccessMode
mode=JSACC_WRITE, unsigned int argc=1, long * argv=0x0012d300, long *
rval=0x0012d300)  Line 1433 + 0x1f	C
 	js3250.dll!js_SetProperty(JSContext * cx=0x02432f70, JSObject *
obj=0x02454fc0, long id=38658944, long * vp=0x0012d300)  Line 2856 + 0x32	C
 	js3250.dll!js_Interpret(JSContext * cx=0x02432f70, unsigned char *
pc=0x024f2b23, long * result=0x0012d44c)  Line 3401 + 0x60b	C
 	js3250.dll!js_Invoke(JSContext * cx=0x02432f70, unsigned int argc=0, unsigned
int flags=0)  Line 1313 + 0x13	C
 	js3250.dll!js_Interpret(JSContext * cx=0x02432f70, unsigned char *
pc=0x024f3eaa, long * result=0x0012df10)  Line 3563 + 0xf	C
 	js3250.dll!js_Invoke(JSContext * cx=0x02432f70, unsigned int argc=1, unsigned
int flags=2)  Line 1313 + 0x13	C
 	xul.dll!nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS * wrapper=0x0270c058,
unsigned short methodIndex=3, const nsXPTMethodInfo * info=0x01ea2540,
nsXPTCMiniVariant * nativeParams=0x0012e230)  Line 1339 + 0x14	C++
 	xul.dll!nsXPCWrappedJS::CallMethod(unsigned short methodIndex=3, const
nsXPTMethodInfo * info=0x01ea2540, nsXPTCMiniVariant * params=0x0012e230) 
Line 450	C++
 	xul.dll!PrepareAndDispatch(nsXPTCStubBase * self=0x0270c058, unsigned int
methodIndex=3, unsigned int * args=0x0012e2f8, unsigned int *
stackBytesToPop=0x0012e2e8)  Line 117 + 0x1c	C++
 	xul.dll!SharedStub()  Line 147	C++
 	xul.dll!nsEventListenerManager::HandleEventSubType(nsListenerStruct *
aListenerStruct=0x0270be68, nsIDOMEvent * aDOMEvent=0x023b9570,
nsIDOMEventTarget * aCurrentTarget=0x0245db18, unsigned int aSubType=8, unsigned
int aPhaseFlags=7)  Line 1521 + 0x14	C++
 	xul.dll!nsEventListenerManager::HandleEvent(nsPresContext *
aPresContext=0x023bf308, nsEvent * aEvent=0x0012e868, nsIDOMEvent * *
aDOMEvent=0x0012e81c, nsIDOMEventTarget * aCurrentTarget=0x0245db18, unsigned
int aFlags=7, nsEventStatus * aEventStatus=0x0012e864)  Line 1615	C++
 	xul.dll!nsXULElement::HandleDOMEvent(nsPresContext * aPresContext=0x023bf308,
nsEvent * aEvent=0x0012e868, nsIDOMEvent * * aDOMEvent=0x0012e81c, unsigned int
aFlags=7, nsEventStatus * aEventStatus=0x0012e864)  Line 2046	C++
 	xul.dll!PresShell::HandleDOMEventWithTarget(nsIContent *
aTargetContent=0x026eb800, nsEvent * aEvent=0x0012e868, nsEventStatus *
aStatus=0x0012e864)  Line 6023	C++
 	xul.dll!nsButtonBoxFrame::MouseClicked(nsPresContext *
aPresContext=0x023bf308, nsGUIEvent * aEvent=0x0012eacc)  Line 177	C++
 	xul.dll!nsButtonBoxFrame::HandleEvent(nsPresContext * aPresContext=0x023bf308,
nsGUIEvent * aEvent=0x0012eacc, nsEventStatus * aEventStatus=0x0012ef8c)  Line
149	C++
 	xul.dll!PresShell::HandleEventInternal(nsEvent * aEvent=0x0012eacc, nsIView *
aView=0x00000000, unsigned int aFlags=1, nsEventStatus * aStatus=0x0012ef8c) 
Line 5986 + 0x27	C++
 	xul.dll!PresShell::HandleEventWithTarget(nsEvent * aEvent=0x0012eacc, nsIFrame
* aFrame=0x026f3224, nsIContent * aContent=0x026eb800, unsigned int aFlags=1,
nsEventStatus * aStatus=0x0012ef8c)  Line 5848 + 0x16	C++
 	xul.dll!nsEventStateManager::CheckForAndDispatchClick(nsPresContext *
aPresContext=0x023bf308, nsMouseEvent * aEvent=0x0012f1e8, nsEventStatus *
aStatus=0x0012ef8c)  Line 2949 + 0x42	C++
 	xul.dll!nsEventStateManager::PostHandleEvent(nsPresContext *
aPresContext=0x023bf308, nsEvent * aEvent=0x0012f1e8, nsIFrame *
aTargetFrame=0x026f3224, nsEventStatus * aStatus=0x0012ef8c, nsIView *
aView=0x026fac60)  Line 1935 + 0x17	C++
 	xul.dll!PresShell::HandleEventInternal(nsEvent * aEvent=0x0012f1e8, nsIView *
aView=0x026fac60, unsigned int aFlags=1, nsEventStatus * aStatus=0x0012ef8c) 
Line 5996 + 0x34	C++
 	xul.dll!PresShell::HandleEvent(nsIView * aView=0x026fac60, nsGUIEvent *
aEvent=0x0012f1e8, nsEventStatus * aEventStatus=0x0012ef8c, int aForceHandle=0,
int & aHandled=1)  Line 5787 + 0x19	C++
 	xul.dll!nsViewManager::HandleEvent(nsView * aView=0x023efd98, nsGUIEvent *
aEvent=0x0012f1e8, int aCaptured=1)  Line 2485	C++
 	xul.dll!nsViewManager::DispatchEvent(nsGUIEvent * aEvent=0x0012f1e8,
nsEventStatus * aStatus=0x0012f0bc)  Line 2206 + 0x14	C++
 	xul.dll!HandleEvent(nsGUIEvent * aEvent=0x0012f1e8)  Line 174	C++
 	xul.dll!nsWindow::DispatchEvent(nsGUIEvent * event=0x0012f1e8, nsEventStatus &
aStatus=nsEventStatus_eIgnore)  Line 1114 + 0xa	C++
 	xul.dll!nsWindow::DispatchWindowEvent(nsGUIEvent * event=0x0012f1e8)  Line
1135	C++
 	xul.dll!nsWindow::DispatchMouseEvent(unsigned int aEventType=301, unsigned int
wParam=0, nsPoint * aPoint=0x00000000)  Line 5411 + 0x15	C++
 	xul.dll!ChildWindow::DispatchMouseEvent(unsigned int aEventType=301, unsigned
int wParam=0, nsPoint * aPoint=0x00000000)  Line 5665	C++
 	xul.dll!nsWindow::ProcessMessage(unsigned int msg=514, unsigned int wParam=0,
long lParam=458785, long * aRetValue=0x0012f6e4)  Line 4109 + 0x1c	C++
 	xul.dll!nsWindow::WindowProc(HWND__ * hWnd=0x000302ee, unsigned int msg=514,
unsigned int wParam=0, long lParam=458785)  Line 1400 + 0x1b	C++
 	user32.dll!77d13a50() 	
 	user32.dll!77d13b1f() 	
 	user32.dll!77d13d79() 	
 	user32.dll!77d13fd4() 	
 	user32.dll!77d13ddf() 	
 	xul.dll!nsAppShell::Run()  Line 135	C++
 	tkitcmps.dll!nsAppStartup::Run()  Line 146	C++
 	xulrunner.exe!xre_main(int argc=3, char * * argv=0x002ff0d8, const
nsXREAppData * aAppData=0x00427520)  Line 1888 + 0x23	C++
 	xulrunner.exe!main(int argc=3, char * * argv=0x002ff0d8)  Line 286 + 0x11	C++
 	xulrunner.exe!mainCRTStartup()  Line 398 + 0x11	C
 	KERNEL32.DLL!77e614c7() 	


Expected Results:  
Expected is that an exception is thrown. The application should not crash.
Assignee: dbradley → dougt
Component: XPConnect → XPCOM
QA Contact: pschwartau
Assignee: dougt → timeless
Status: UNCONFIRMED → ASSIGNED
Attachment #175409 - Flags: review?(dougt)
Attachment #175409 - Flags: review?(dougt) → review+
Comment on attachment 175409 [details] [diff] [review]
look before leaping and don't treat a PRStatus as an nsresult

mozilla/xpcom/threads/nsProcessCommon.cpp	1.17
Attachment #175409 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: