Closed Bug 333312 Opened 14 years ago Closed 14 years ago

[@ JS_GetGlobalObject - nsHTTPIndex::OnFTPControlLog]

Categories

(Core :: Networking: FTP, defect, critical)

1.8 Branch
defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla1.8.1beta1

People

(Reporter: timeless, Assigned: Gavin)

References

(Blocks 1 open bug, )

Details

(Keywords: coverity, crash, fixed1.8.1)

Crash Data

Attachments

(1 file)

found by coverity

the jscontext null check should happen before the JS_GetGlobalObject call, not after it :(.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch patchSplinter Review
Assignee: nobody → gavin.sharp
Status: NEW → ASSIGNED
Attachment #217775 - Flags: superreview?(jag)
Attachment #217775 - Flags: review?(timeless)
Comment on attachment 217775 [details] [diff] [review]
patch

>Index: xpfe/components/directory/nsDirectoryViewer.cpp
>@@ -185,21 +185,21 @@ nsHTTPIndex::OnFTPControlLog(PRBool serv
>     nsCOMPtr<nsIScriptGlobalObject> scriptGlobal(do_GetInterface(mRequestor));
>     NS_ENSURE_TRUE(scriptGlobal, NS_OK);
> 
>     nsIScriptContext *context = scriptGlobal->GetContext();
>     NS_ENSURE_TRUE(context, NS_OK);
> 
>     JSContext* jscontext = NS_REINTERPRET_CAST(JSContext*,
>                                                context->GetNativeContext());
>+    NS_ENSURE_TRUE(jscontext, NS_OK);
> 
>     JSObject* global = JS_GetGlobalObject(jscontext);
>+    NS_ENSURE_TRUE(global, NS_OK);

ensure_ macros will complain on failure, so if these are normal cases, we should probably use simple returns instead.

but it's definitely in file style
Attachment #217775 - Flags: review?(timeless) → review+
I don't think any of them are normal cases.
Attachment #217775 - Flags: superreview?(jag) → superreview+
Whiteboard: [checkin needed]
mozilla/xpfe/components/directory/nsDirectoryViewer.cpp 	1.124
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
OS: Linux → All
Hardware: PC → All
Resolution: --- → FIXED
Whiteboard: [checkin needed]
Target Milestone: --- → mozilla1.9alpha
Attachment #217775 - Flags: approval-branch-1.8.1?(neil)
Attachment #217775 - Flags: approval-branch-1.8.1?(neil) → approval-branch-1.8.1+
Whiteboard: [checkin needed (1.8 branch)]
mozilla/xpfe/components/directory/nsDirectoryViewer.cpp 	1.120.16.1
Keywords: fixed1.8.1
Whiteboard: [checkin needed (1.8 branch)]
Target Milestone: mozilla1.9alpha → mozilla1.8.1beta1
Version: Trunk → 1.8 Branch
Crash Signature: [@ JS_GetGlobalObject - nsHTTPIndex::OnFTPControlLog]
You need to log in before you can comment on or make changes to this bug.