Closed Bug 1125592 Opened 11 years ago Closed 11 years ago

Fix -Wmaybe-uninitialized warning in security/manager/ssl/src/nsNSSASN1Object.cpp

Categories

(Core :: Security: PSM, defect)

All
Android
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38

People

(Reporter: cpeterson, Assigned: cpeterson)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

getDERItemLength() can return error (len == -1) without initializing bytesUsed, so check for error before using bytesUsed: security/manager/ssl/src/nsNSSASN1Object.cpp:131:22: warning: 'bytesUsed' may be used uninitialized in this function [-Wmaybe-uninitialized]
Attachment #8554239 - Flags: review?(dkeeler)
Comment on attachment 8554239 [details] [diff] [review] Wuninitialized_nsNSSASN1Object.patch Review of attachment 8554239 [details] [diff] [review]: ----------------------------------------------------------------- r=me with the suggested change. Thanks for taking care of this! ::: security/manager/ssl/src/nsNSSASN1Object.cpp @@ +131,1 @@ > if ((len < 0) || ((data+len) > end)) Unfortunately 'data' is used in this expression. Let's do something like this: if (len < 0) { return NS_ERROR_FAILURE; } data += bytesUsed; if (data + len > end) { return NS_ERROR_FAILURE; } (although I suppose the other option is to use bytesUsed in the original expression)
Attachment #8554239 - Flags: review?(dkeeler) → review+
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: