Closed
Bug 1034634
Opened 11 years ago
Closed 11 years ago
Fix compiler warnings in ScopedNSSTypes.h
Categories
(Core :: Security: PSM, defect)
Core
Security: PSM
Tracking
()
RESOLVED
FIXED
mozilla33
People
(Reporter: briansmith, Assigned: briansmith)
References
Details
Attachments
(1 file)
|
3.20 KB,
patch
|
mmc
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Attachment #8451012 -
Flags: review?(mmc)
Comment 1•11 years ago
|
||
Comment on attachment 8451012 [details] [diff] [review]
ScopedNSSTypes-without-warnings.patch
Review of attachment 8451012 [details] [diff] [review]:
-----------------------------------------------------------------
::: security/manager/ssl/src/ScopedNSSTypes.h
@@ +173,5 @@
> }
>
> nsresult DigestBuf(SECOidTag hashAlg, const uint8_t * buf, uint32_t len)
> {
> + if (len > static_cast<uint32_t>(std::numeric_limits<int32_t>::max())) {
Seems odd to check uint32_t against max of a different type, but I guess this is because HashBuf takes the wrong type.
@@ +204,2 @@
> {
> case SEC_OID_SHA1: item.len = SHA1_LENGTH; break;
This style seems prone to goto-fail bugs. All it takes is one missing break.
Attachment #8451012 -
Flags: review?(mmc) → review+
| Assignee | ||
Comment 2•11 years ago
|
||
(In reply to [:mmc] Monica Chew (please use needinfo) from comment #1)
> ::: security/manager/ssl/src/ScopedNSSTypes.h
> @@ +173,5 @@
> > }
> >
> > nsresult DigestBuf(SECOidTag hashAlg, const uint8_t * buf, uint32_t len)
> > {
> > + if (len > static_cast<uint32_t>(std::numeric_limits<int32_t>::max())) {
>
> Seems odd to check uint32_t against max of a different type, but I guess
> this is because HashBuf takes the wrong type.
Right. And, I remember that the NSS team didn't want to change it, because it might break source compatibility. :(
> @@ +204,2 @@
> > {
> > case SEC_OID_SHA1: item.len = SHA1_LENGTH; break;
>
> This style seems prone to goto-fail bugs. All it takes is one missing break.
This style was chosen to make a missing break more obvious. Basically C/C++ switch statements suck.
Thanks for the review!
https://hg.mozilla.org/integration/mozilla-inbound/rev/5bd954b643e9
Comment 3•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•