Closed
Bug 71283
Opened 25 years ago
Closed 25 years ago
nsEventListenerManager::AddEventListener crashes if passed null listener
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Tracking
()
VERIFIED
FIXED
mozilla0.9
People
(Reporter: alex, Assigned: joki)
References
()
Details
Attachments
(1 file)
|
744 bytes,
patch
|
Details | Diff | Splinter Review |
... because of a missing null-pointer check. Same for RemoveEventListener.
Trival fix:
Index: nsEventListenerManager.cpp
===================================================================
RCS file: /cvsroot/mozilla/content/events/src/nsEventListenerManager.cpp,v
retrieving revision 1.87
diff -c -7 -r1.87 nsEventListenerManager.cpp
*** nsEventListenerManager.cpp 2001/01/23 03:10:25 1.87
--- nsEventListenerManager.cpp 2001/03/08 10:35:19
***************
*** 237,250 ****
--- 237,252 ----
nsresult nsEventListenerManager::AddEventListener(nsIDOMEventListener
*aListener,
const nsIID& aIID,
PRInt32 aFlags,
PRInt32 aSubType)
{
nsVoidArray** listeners = GetListenersByIID(aIID);
+ if (nsnull == listeners) return NS_ERROR_FAILURE;
+
if (nsnull == *listeners) {
*listeners = new nsVoidArray();
}
if (nsnull == *listeners) {
return NS_ERROR_OUT_OF_MEMORY;
}
***************
*** 314,327 ****
--- 316,331 ----
nsresult nsEventListenerManager::RemoveEventListener(nsIDOMEventListener
*aListener,
const nsIID& aIID,
PRInt32 aFlags,
PRInt32 aSubType)
{
nsVoidArray** listeners = GetListenersByIID(aIID);
+
+ if (nsnull == listeners) return NS_ERROR_FAILURE;
if (nsnull == *listeners) {
return NS_OK;
}
nsListenerStruct* ls;
nsresult rv;
Comment 1•25 years ago
|
||
confirm bug to get on the radar
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 2•25 years ago
|
||
Regarding the fix, you should return |NS_ERROR_NULL_POINTER| for nullpointers.
| Reporter | ||
Comment 3•25 years ago
|
||
Surely you should return NS_ERROR_NULL_POINTER only if the function was
actually passed a null pointer of sorts as an argument.
NS_ERROR_INVALID_ARG is probably the right choice here?
| Assignee | ||
Comment 4•25 years ago
|
||
Adding to 0.9 list. Will check in fix when tree opens.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9
Comment 5•25 years ago
|
||
Has this been checked in?
| Assignee | ||
Comment 7•25 years ago
|
||
Sorry, didn't check in patch alone as it got wrapped into a larger patch/rewrite
of the surrounding code.
| Assignee | ||
Comment 8•25 years ago
|
||
Create/Init/Dispatch bugs all fixed. Patches are attached to bug 25889.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Comment 9•25 years ago
|
||
Still crashing at http://www.protocol7.com/scroll/nsbug.html, Testcase from a
duplicate bug #74732. (build 2001-04-19-04-trunk windows 98)
| Assignee | ||
Comment 10•25 years ago
|
||
Okay, same function different crash. Close enough to be a dupe. I'll see if I
can get a fix allowed in.
Status: REOPENED → ASSIGNED
Summary: nsEventListenerManager::AddEventListener crashes if passed unknown listener iid → nsEventListenerManager::AddEventListener crashes if passed null listener
| Assignee | ||
Comment 11•25 years ago
|
||
Comment 12•25 years ago
|
||
[s]r=jst
Comment 13•25 years ago
|
||
Are you still shooting for 0.9 on this? If so please email drivers@mozilla.org
with a status on you progress. If not please retarget against a later Milestone.
Thanks.
| Assignee | ||
Comment 14•25 years ago
|
||
Checked in with approval from choffmann from friday.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago → 25 years ago
Resolution: --- → FIXED
Updated•7 years ago
|
Component: Event Handling → User events and focus handling
You need to log in
before you can comment on or make changes to this bug.
Description
•