Closed Bug 1234510 Opened 10 years ago Closed 9 years ago

[CID 748763] modulo zero in p7local.c

Categories

(NSS :: Libraries, defect)

defect
Not set
normal

Tracking

(firefox46 affected)

RESOLVED FIXED
Tracking Status
firefox46 --- affected

People

(Reporter: franziskus, Assigned: mds)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID748763)

Attachments

(3 files, 1 obsolete file)

sec_PKCS7Encrypt in p7local.c might do modulo zero (padsize).
Assignee: nobody → michelangelo
Attachment #8720609 - Flags: review?(franziskuskiefer)
Comment on attachment 8720609 [details] [diff] [review] Avoid modulo zero in sec_PKCS7Encrypt Review of attachment 8720609 [details] [diff] [review]: ----------------------------------------------------------------- LGTM Michelangelo wrote: > to my knowledge a mod0 shoudln't > happen over there, unless the compiler is "stupid enough" to not optmize > the predicate. that might be correct, but we probably shouldn't rely on it. And like this we can make coverity happy (and steve asked for something easy ;).
Attachment #8720609 - Flags: review?(franziskuskiefer) → review+
Comment on attachment 8720609 [details] [diff] [review] Avoid modulo zero in sec_PKCS7Encrypt Review of attachment 8720609 [details] [diff] [review]: ----------------------------------------------------------------- just noticed I messed up and gave you the wrong line... You're right that the line I gave you in the e-mail is not a problem, but [1] is. https://dxr.mozilla.org/mozilla-central/source/security/nss/lib/pkcs7/p7local.c#714
Attachment #8720609 - Flags: review+
Attachment #8721087 - Flags: review?(franziskuskiefer)
Attachment #8720609 - Attachment is obsolete: true
Comment on attachment 8721087 [details] [diff] [review] Fix for mod0 in sec_PKCS7Encrypt Review of attachment 8721087 [details] [diff] [review]: ----------------------------------------------------------------- LGTM
Attachment #8721087 - Flags: review?(franziskuskiefer) → review+
Nice, thank you Franziskus!
Should we close this now? Sorry, just asking out of ignorance: I'm not sure about the workflow in this case.:)
right, I marked it as resolved and set tracking for 3.23 (the next NSS release)
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.23
Attached patch bug1234510.patchSplinter Review
This is a better fix. The current fix adds a build warning.
Attachment #8728322 - Flags: review?(franziskuskiefer)
I'll let you pick which one of these looks best, I think that this might be better.
Attachment #8728339 - Flags: review?(franziskuskiefer)
Comment on attachment 8728339 [details] [diff] [review] bug1234510v2.patch Review of attachment 8728339 [details] [diff] [review]: ----------------------------------------------------------------- ::: lib/pkcs7/p7local.c @@ +710,5 @@ > PORT_Memcpy (pbuf, input + ifraglen, pcount); > } > > if (final) { > + padlen = padsize - (pcount % padsize); This would bring back mod zero, let's use the other patch.
Attachment #8728339 - Flags: review?(franziskuskiefer) → review-
Attachment #8728322 - Flags: review?(franziskuskiefer) → review+
(In reply to Martin Thomson [:mt:] from comment #10) > The current fix adds a build warning. Do you have a dump of the warning?
(In reply to Michelangelo De Simone from comment #14) > (In reply to Martin Thomson [:mt:] from comment #10) > > > The current fix adds a build warning. > > Do you have a dump of the warning? See bug 1254406 comment 3.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: