Closed Bug 487179 Opened 16 years ago Closed 4 years ago

nsHashtable::Put is unsafe

Categories

(Core :: XPCOM, defect)

x86
Windows XP
defect
Not set
critical

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: timeless, Unassigned)

References

()

Details

(Keywords: crash, memory-leak)

204 void *nsHashtable::Put(nsHashKey *aKey, void *aData) 206 void *res = NULL; 215 HTEntry* entry = 216 static_cast<HTEntry*> 217 (PL_DHashTableOperate(&mHashtable, aKey, PL_DHASH_ADD)); 219 if (entry) { // don't return early, or you'll be locked! 225 // new entry (leave res == null) 226 entry->key = aKey->Clone(); 233 return res; 1. #217 PL_DHASH_ADD can fail, if it does, application logic won't know and will leak. 2. #226 Clone can fail, if it does, application logic won't know, and the item will not be found (this is essentially a leak). If anyone ever compares against such a node, it will crash in the Key::Equals method.

Hello,
Can you still reproduce this issue or should we close it?

Flags: needinfo?(timeless)

nsHashtable does not exist, so I think we can close this.

Status: NEW → RESOLVED
Closed: 4 years ago
Flags: needinfo?(timeless)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.