void nsContentSupportMap::Init doesn't check the return value of PL_DHashTableInit

RESOLVED FIXED

Status

()

--
minor
RESOLVED FIXED
15 years ago
10 years ago

People

(Reporter: timeless, Assigned: timeless)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Assignee)

Description

15 years ago
This is a code inspection bug.

QA:
To verify that this bug is fixed, make sure that all callers in of 
PL_DHashTableInit in the indicated class/file check and handle a failure return 
result.
To verify that this bug is invalid, simply verify (e.g. with lxr) that 
PL_DHashTableInit is no longer used by the indicated class/file.

PL_DHashTableInit returns a PRBool indicating whether it succeeded. 
PL_DHashTableInit *can* fail. Code can not assume that table->ops or table-
>data will be null (in fact it probably will not be), although in all 
likelyhood table->entryStore will be null it probably isn't safe to assume this.

Code at time of bug filing:

  60 void
  61 nsContentSupportMap::Init()
  62 {
  63     PL_DHashTableInit(&mMap, &gOps, nsnull, sizeof(Entry), 
PL_DHASH_MIN_SIZE);
  64 }
(Assignee)

Comment 1

15 years ago
Created attachment 128528 [details] [diff] [review]
patch
(Assignee)

Updated

15 years ago
Attachment #128528 - Flags: superreview?(bzbarsky)
Attachment #128528 - Flags: review?(dbaron)
Attachment #128528 - Flags: superreview?(bzbarsky) → superreview+
Attachment #128528 - Flags: review?(dbaron) → review+
Comment on attachment 128528 [details] [diff] [review]
patch


>     PRBool Get(nsIContent* aElement, nsTemplateMatch** aMatch) {
>+        if (!mMap.ops)
>+            return NS_ERROR_NOT_INITIALIZED;
>+

Actually, you better return a value of the right type here.  I think you want
PR_FALSE.
(Assignee)

Comment 3

15 years ago
.
Assignee: hyatt → timeless
(Assignee)

Comment 4

15 years ago
checked in
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → FIXED
(Assignee)

Updated

10 years ago
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: shrir → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.