Closed Bug 412889 Opened 17 years ago Closed 17 years ago

Crash when accessing tree columns in nsXULTreeAccessible.cpp

Categories

(Core :: Disability Access APIs, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: aaronlev, Assigned: aaronlev)

Details

(Keywords: access, crash)

Attachments

(1 file)

I didn't check other files but in general it seems dangerous to return NS_OK without setting out params.
Attachment #297678 - Flags: superreview?(neil)
Attachment #297678 - Flags: review?(neil)
Comment on attachment 297678 [details] [diff] [review]
1) Null check cols, 2) Don't return NS_OK unless you have set the out params

>+NS_IMETHODIMP nsTreeBoxObject::GetCellAt(PRInt32 aX, PRInt32 aY, PRInt32 *aRow, nsITreeColumn** aCol,
>+                                         nsACString& aChildElt)
> {
>+  *aRow = 0;
>+  *aCol = nsnull;
Nit: aChildElt.Truncate();
Attachment #297678 - Flags: superreview?(neil)
Attachment #297678 - Flags: superreview+
Attachment #297678 - Flags: review?(neil)
Attachment #297678 - Flags: review+
Attachment #297678 - Flags: approval1.9?
Aaron, following our discussion on IRC, I checked nsXulTreeAccessible.cpp, and this is the only function that uses mTree before checking for its validity.
Do you still want me to file an extra bug on it, or could you put that null check in when you commit this patch?
It should follow the first if block I think, so:
>+  NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE); 
>   nsCOMPtr<nsITreeColumns> cols;
>   nsresult rv = mTree->GetColumns(getter_AddRefs(cols));
>-  NS_ENSURE_SUCCESS(rv, rv);
>+  NS_ENSURE_STATE(cols);


r+=aaron on the null check.

I'll just add the null check when I check it in.
Attachment #297678 - Flags: approval1.9? → approval1.9+
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Verified using Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9b3) Gecko/2008020514 Firefox/3.0b3
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: