Closed Bug 710973 Opened 13 years ago Closed 13 years ago

Possible bad input validation in PresShell::SetResolution()

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla13

People

(Reporter: Dolske, Assigned: daniellevin2607)

References

Details

(Whiteboard: [pvs-studio][good first bug][lang=c++])

Attachments

(1 file)

From http://www.viva64.com/en/a/0078/ Example 6. Incomplete checking of input values nsresult PresShell::SetResolution(float aXResolution, float aYResolution) { if (!(aXResolution > 0.0 && aXResolution > 0.0)) { return NS_ERROR_ILLEGAL_VALUE; } ... } PVS-Studio diagnostic message: V501 There are identical sub-expressions to the left and to the right of the '&&' operator: aXResolution > 0.0 && aXResolution > 0.0 nspresshell.cpp 5114 And here was one more example of invalid input parameters verification. This time, a misprint doesn't allow the program to check the aYResolution argument's value.
Blocks: 710966
Whiteboard: [pvs-studio] → [pvs-studio][good first bug][lang=c++]
Component: General → Layout
QA Contact: general → layout
Attached patch A patch to correct this bug (deleted) — Splinter Review
The double-checking flagged was checking the X value twice and not checking the Y value. The Y value is now checked
Attachment #596338 - Flags: superreview?
Attachment #596338 - Flags: review?
Attachment #596338 - Flags: review?(jones.chris.g)
Comment on attachment 596338 [details] [diff] [review] A patch to correct this bug Stealing review for this obvious fix.
Attachment #596338 - Flags: superreview?
Attachment #596338 - Flags: review?(jones.chris.g)
Attachment #596338 - Flags: review?
Attachment #596338 - Flags: review+
Keywords: checkin-needed
Assignee: nobody → daniellevin2607
Status: NEW → ASSIGNED
https://hg.mozilla.org/mozilla-central/rev/2348e10c9782 Thanks for the patch! Join us on irc (#developers on irc.mozilla.org) and we'll find some other things for you to work on if you are interested? :-D
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: