Closed Bug 211266 Opened 22 years ago Closed 22 years ago

void nsHTMLEntities::AddRefTable doesn't check the return value of PL_DHashTableInit

Categories

(Core :: DOM: HTML Parser, defect)

x86
Windows 2000
defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

References

()

Details

Attachments

(1 file)

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: 134 void 135 nsHTMLEntities::AddRefTable(void) 136 { 137 if (++gTableRefCnt != 1) 138 return; 139 140 PL_DHashTableInit(&gEntityToUnicode, &EntityToUnicodeOps, 141 nsnull, sizeof(EntityNodeEntry), 142 PRUint32(NS_HTML_ENTITY_COUNT / 0.75)); 143 PL_DHashTableInit(&gUnicodeToEntity, &UnicodeToEntityOps, 144 nsnull, sizeof(EntityNodeEntry), 145 PRUint32(NS_HTML_ENTITY_COUNT / 0.75));
Attached patch proposal oneSplinter Review
.
Assignee: harishd → timeless
Attachment #133953 - Flags: superreview?(hjtoi-bugzilla)
Attachment #133953 - Flags: review?(axel)
Comment on attachment 133953 [details] [diff] [review] proposal one r=axel@pike.org, though I personally prefer to add the early return back. Even if that means to increment the refcount at two different places. Heikki's call.
Attachment #133953 - Flags: review?(axel) → review+
Attachment #133953 - Flags: superreview?(hjtoi-bugzilla) → superreview+
checked in
Status: NEW → RESOLVED
Closed: 22 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: