The default bug view has changed. See this FAQ.

Possible bad input validation in PresShell::SetResolution()

RESOLVED FIXED in mozilla13

Status

()

Core
Layout
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Dolske, Assigned: Daniel Levin)

Tracking

(Blocks: 1 bug)

unspecified
mozilla13
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

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

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
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.
(Reporter)

Updated

5 years ago
Blocks: 710966
Whiteboard: [pvs-studio] → [pvs-studio][good first bug][lang=c++]
Component: General → Layout
QA Contact: general → layout
Blocks: 590294
(Assignee)

Comment 1

5 years ago
Created attachment 596338 [details] [diff] [review]
A patch to correct this bug

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?
(Assignee)

Updated

5 years ago
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
http://hg.mozilla.org/integration/mozilla-inbound/rev/2348e10c9782
Keywords: checkin-needed
Target Milestone: --- → mozilla13
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
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.