Closed
Bug 1127158
Opened 9 years ago
Closed 8 years ago
Incorrect flag math in nsSecureBrowserUIImpl.cpp?
Categories
(Core :: Security: PSM, defect)
Core
Security: PSM
Tracking
()
RESOLVED
FIXED
mozilla48
Tracking | Status | |
---|---|---|
firefox48 | --- | fixed |
People
(Reporter: jduell.mcbugs, Assigned: Cykesiopka)
References
Details
(Whiteboard: [psm-assigned])
Attachments
(1 file)
What's up with all the '-=' operations on testFlags here? https://dxr.mozilla.org/mozilla-central/source/security/manager/boot/src/nsSecureBrowserUIImpl.cpp?from=nsSecureBrowserUIImpl.cpp#839 It looks like they should all be "& ~(FLAG)", not "-= FLAG". (These are boolean flags we're trying to filter out, so subtracting doesn't make sense.) Also we don't ever user 'testArgs' so not sure of the point of that variable. The same boolean flag math error applies to the 'f' variable as well: https://dxr.mozilla.org/mozilla-central/source/security/manager/boot/src/nsSecureBrowserUIImpl.cpp?from=nsSecureBrowserUIImpl.cpp#858
Reporter | ||
Comment 1•9 years ago
|
||
make that "&= ~(FLAG)", of course.
Comment 2•9 years ago
|
||
Hmm, I think it's _technically_ correct, because it's always checking that the flag is set before subtracting it. But that seems like a horrible, horrible antipattern and should definitely be changed. Too easy to screw up and is conceptually wrong.
Assignee | ||
Comment 3•9 years ago
|
||
Hmm, this is all debug code. I wonder if anyone even uses it.
Blocks: 832834
Assignee | ||
Comment 4•8 years ago
|
||
(In reply to :Cykesiopka from comment #3) > Hmm, this is all debug code. I wonder if anyone even uses it. I'm going to assume no here and just remove this code. Reasoning: - It's brittle, as mentioned in previous comments. - nsSecureBrowserUIImpl.cpp is already a huge pain to read. We don't need more clutter. - As more code gets landed all over the tree to support features, stuff like this need to go away so rising compile times are mitigated. If you do use this code, please maintain a local patch instead.
Assignee: nobody → cykesiopka.bmo
Severity: normal → minor
Status: NEW → ASSIGNED
Component: Security → Security: PSM
OS: Linux → All
Hardware: x86 → All
Whiteboard: [psm-assigned]
Assignee | ||
Comment 5•8 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/43791/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/43791/
Attachment #8737396 -
Flags: review?(dkeeler)
Comment on attachment 8737396 [details] MozReview Request: Bug 1127158 - Remove brittle debug only flag math in nsSecureBrowserUIImpl.cpp. https://reviewboard.mozilla.org/r/43791/#review40743 Yeah, let's just get rid of this.
Attachment #8737396 -
Flags: review?(dkeeler) → review+
Assignee | ||
Comment 7•8 years ago
|
||
Thanks for the review! https://treeherder.mozilla.org/#/jobs?repo=try&revision=6a45bc62f95768a9c74c0a66268ef7a137ed0423
Keywords: checkin-needed
Comment 9•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/8cdccb1dd539
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox48:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in
before you can comment on or make changes to this bug.
Description
•