Closed
Bug 337017
Opened 19 years ago
Closed 19 years ago
Coverity 521 NEGATIVE_RETURNS in NSS_SMIMEUtil_FindBulkAlgForRecipients
Categories
(NSS :: Libraries, enhancement, P4)
Tracking
(Not tracked)
RESOLVED
INVALID
3.11.2
People
(Reporter: timeless, Unassigned)
References
()
Details
(Keywords: coverity)
I know the code implies that this can't happen, but i'd much rather we handle it.
Event negative_return_fn: Called negative-returning function "smime_mapi_by_cipher" [model]
Event var_assign: NEGATIVE return value of "smime_mapi_by_cipher" assigned to signed variable "mapi"
Also see events: [var_assign][negative_returns]
561 mapi = smime_mapi_by_cipher(cipher);
562
At conditional (1): "i < smime_cipher_map_count" taking true path
At conditional (3): "i < smime_cipher_map_count" taking true path
At conditional (5): "i < smime_cipher_map_count" taking true path
At conditional (7): "i < smime_cipher_map_count" taking false path
164 for (i = 0; i < smime_cipher_map_count; i++) {
At conditional (2): "(smime_cipher_map[i]).cipher == cipher" taking false path
At conditional (4): "(smime_cipher_map[i]).cipher == cipher" taking false path
At conditional (6): "(smime_cipher_map[i]).cipher == cipher" taking false path
165 if (smime_cipher_map[i].cipher == cipher)
166 return i; /* bingo */
167 }
Event return_negative_constant: Explicitly returning NEGATIVE value "-1"
168 return -1; /* should not happen if we're consistent, right? */
Event negative_returns: Tracked variable "mapi" used as index to array "smime_cipher_map"
Also see events: [negative_return_fn][var_assign]
563 *bulkalgtag = smime_cipher_map[mapi].algtag;
Updated•19 years ago
|
Hardware: PC → All
Target Milestone: --- → 3.11.2
Comment 1•19 years ago
|
||
There is no bug here.
563 cipher = smime_choose_cipher(NULL, rcerts);
564 mapi = smime_mapi_by_cipher(cipher);
565
566 *bulkalgtag = smime_cipher_map[mapi].algtag;
Function smime_choose_cipher ALWAYS returns a cipher that is in the mapping
table. Function smime_mapi_by_cipher will ALWAYS return a valid index into
that mapping table if it is given a cipher in that table. So, the result
is that mapi cannot have an out-of-bounds value.
Now, coverity guys, is there some comment we can put into the code here (like the comments one puts into to silence lint) that will silence coverity about this?
Priority: -- → P4
Comment 2•19 years ago
|
||
I marked this as a FALSE POSITIVE in coverity.
Reopen this bug if coverity won't take "no" (FALSE) for an answer.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
Summary: Please handle NEGATIVE_RETURNS in NSS_SMIMEUtil_FindBulkAlgForRecipients → Coverity 521 NEGATIVE_RETURNS in NSS_SMIMEUtil_FindBulkAlgForRecipients
You need to log in
before you can comment on or make changes to this bug.
Description
•