Last Comment Bug 140474 - PK11_FindCertsFromNickname may cause an assertion failure in nssList_GetArray.
: PK11_FindCertsFromNickname may cause an assertion failure in nssList_GetArray.
Status: RESOLVED FIXED
[adt2 RTM]
:
Product: NSS
Classification: Components
Component: Libraries (show other bugs)
: 3.4
: All All
: -- normal (vote)
: 3.4.2
Assigned To: Ian McGreer
: Bishakha Banerjee
Mentors:
Depends on:
Blocks: 145836
  Show dependency treegraph
 
Reported: 2002-04-26 17:28 PDT by Wan-Teh Chang
Modified: 2002-06-04 21:00 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
patch against 3.4 branch (719 bytes, patch)
2002-04-29 06:29 PDT, Ian McGreer
wtc: review+
Details | Diff | Splinter Review

Description Wan-Teh Chang 2002-04-26 17:28:24 PDT
nssList_GetArray asserts that the maxElements argument is > 0.
nssList_GetArray will malfunction if maxElements is 0.

It is possible for PK11_FindCertsFromNickname to call nssList_GetArray
with maxElements equal to 0, which causes the assertion to fail:
        if (nameList) {
            count = nssList_Count(nameList);
            foundCerts = nss_ZNEWARRAY(NULL, NSSCertificate *, count + 1);
            nssList_GetArray(nameList, (void **)foundCerts, count);
            nssList_Destroy(nameList);
        }
Comment 1 Ian McGreer 2002-04-29 06:29:37 PDT
Created attachment 81485 [details] [diff] [review]
patch against 3.4 branch
Comment 2 Ian McGreer 2002-04-30 12:36:43 PDT
patch checked in to branch, closing bug.

This fix is not needed for the tip.
Comment 3 Wan-Teh Chang 2002-04-30 14:06:03 PDT
Comment on attachment 81485 [details] [diff] [review]
patch against 3.4 branch

I think strictly speaking we also need to handle the
failure of nss_ZNEWARRAY (out-of-memory error), that
is, something like:

	foundCerts = nss_ZNEWARRAY(NULL, NSSCertificate *, count + 1);
	if (foundCerts) {
	    nssList_GetArray(nameList, (void **)foundCerts, count);
	}

but this patch is a strict improvement over the old code.

r=wtc.
Comment 4 Wan-Teh Chang 2002-05-01 19:23:07 PDT
Set target milestone to NSS 3.4.2.
Comment 5 Jaime Rodriguez, Jr. 2002-05-31 19:07:24 PDT
adt1.0.1+ (on ADT's behalf) for checkin to the 1.0 branch. Pls check this in
asap. thanks! 

Note You need to log in before you can comment on or make changes to this bug.