Closed
Bug 1209152
Opened 10 years ago
Closed 10 years ago
[Coverity 1123241] Leak of memory or pointers to system resources in ssl3_HandleECDHServerKeyExchange
Categories
(NSS :: Libraries, defect)
NSS
Libraries
Tracking
(firefox44 affected)
RESOLVED
FIXED
| Tracking | Status | |
|---|---|---|
| firefox44 | --- | affected |
People
(Reporter: ttaubert, Assigned: ttaubert)
References
(Blocks 1 open bug)
Details
> arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
> if (arena == NULL) {
> goto no_memory;
> }
>
> ss->sec.peerKey = peerKey = PORT_ArenaZNew(arena, SECKEYPublicKey);
> if (peerKey == NULL) {
> goto no_memory;
> }
9. leaked_storage: Variable arena going out of scope leaks the storage it points to.
Comment 1•10 years ago
|
||
Assuming I am reading this correctly, this creates a leak if we have an OOM in
PORT_ArenaZNew, right?
I see that below we actually do handle this case.
https://dxr.mozilla.org/mozilla-central/source/security/nss/lib/ssl/ssl3ecc.c?case=true&from=ssl3_HandleECDHServerKeyExchange#728
Probably the right fix is to have no_memory delete arena if non-nULL
| Assignee | ||
Comment 2•10 years ago
|
||
(In reply to Eric Rescorla (:ekr) from comment #1)
> Assuming I am reading this correctly, this creates a leak if we have an OOM
> in PORT_ArenaZNew, right?
Yeah, although it's very unlikely because we just created the arena. OTOH |PORT_ArenaAlloc()| can also fail if another thread holds a mark in it.
> Probably the right fix is to have no_memory delete arena if non-nULL
Yeah, that would also cover |alert_loser| where we currently don't free the arena either, and I think we should?
Another thing: in that function we assign to |ss->sec.peerKey| twice, once when allocating and again shortly before returning SECSuccess. We should probably remove the first assignment? I assume it is the reason why Coverity isn't complaining about the |alert_loser| case if we assigned it to |ss| already before bailing out.
| Assignee | ||
Updated•10 years ago
|
Assignee: nobody → ttaubert
Status: NEW → ASSIGNED
| Assignee | ||
Comment 3•10 years ago
|
||
Flags: needinfo?(ekr)
Comment 4•10 years ago
|
||
Comments up.
Updated•10 years ago
|
Flags: needinfo?(ekr)
| Assignee | ||
Updated•10 years ago
|
Depends on: CVE-2016-1978
| Assignee | ||
Comment 5•10 years ago
|
||
Fixed by bug 1209546.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•