klocwork OOM crash in tdcache.c

RESOLVED FIXED in 3.12

Status

NSS
Libraries
P2
normal
RESOLVED FIXED
11 years ago
11 years ago

People

(Reporter: Nelson Bolyard (seldom reads bugmail), Assigned: Alexei Volkov)

Tracking

({klocwork})

trunk
3.12
klocwork

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

1019 bytes, patch
Nelson Bolyard (seldom reads bugmail)
: review+
Details | Diff | Splinter Review
ID:       90055
Function: collect_subject_certs
Location: nss/lib/pki/tdcache.c : 901

Pointer 'iter' returned from call to function 'nssList_CreateIterator' at 
line 900 may be NULL and will be dereferenced by passing argument 1 to 
function 'nssListIterator_Start' at line 901.

900		nssListIterator *iter = nssList_CreateIterator(subjectList); 
901		for (c  = (NSSCertificate *)nssListIterator_Start(iter);
(Reporter)

Updated

11 years ago
Priority: -- → P2
Target Milestone: --- → 3.12
(Assignee)

Comment 1

11 years ago
Created attachment 241226 [details] [diff] [review]
partial fix
Assignee: nobody → alexei.volkov.bugs
Status: NEW → ASSIGNED
Attachment #241226 - Flags: review?(nelson)
(Reporter)

Comment 2

11 years ago
Comment on attachment 241226 [details] [diff] [review]
partial fix

This patch is correct with respect to preventing the crash.
It makes the "if (rvCertListOpt)" code be as correct as the "else" code.

But it appears to me that there is a reference leak (actually, a bunch 
of them) in both of those two paths.  Notice the call to 
nssCertificateList_AddReferences.  It adds a reference to every cert 
in the "subjectList".  If we fail to creat the iterator, those new
references must be released, or else those references will be leaked.

We can either 
(a) commit this patch and file a separate bug about that leak or 
(b) try to fix that leak for this bug in a new patch.
Alexei, I'll let you decide.
Attachment #241226 - Attachment description: fix → partial fix
Attachment #241226 - Flags: review?(nelson) → review+
(Assignee)

Comment 3

11 years ago
/cvsroot/mozilla/security/nss/lib/pki/tdcache.c,v  <--  tdcache.c
new revision: 1.45; previous revision: 1.44
Status: ASSIGNED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.