Closed
Bug 840720
Opened 11 years ago
Closed 11 years ago
Check for the finiteness of the values returned from the ToDouble calls in the nsHTMLInputElement code
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla21
People
(Reporter: jwatt, Assigned: jwatt)
References
(Depends on 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
3.66 KB,
patch
|
mounir
:
review+
|
Details | Diff | Splinter Review |
It seems that nsTString_CharT::ToDouble can return +/-Infinity while returning NS_OK via the out-param. (See bug 836314 comment 15.) We should check the value returned from the ToDouble calls in ConvertStringToNumber and convert them to NaN if they are not finite so that ConvertStringToNumber's callers handle bad user input correctly.
Updated•11 years ago
|
Flags: in-testsuite?
Assignee | ||
Updated•11 years ago
|
Summary: Check the values returned from the ToDouble calls in ConvertStringToNumber are finite → Check for the finiteness of the values returned from the ToDouble calls in the nsHTMLInputElement code
Comment 1•11 years ago
|
||
I guess the best behaviour would be to do something like: - parse the value to double; - check if the value is finite; - if it is not, return false (all callers correctly check that the method return true).
Assignee | ||
Comment 2•11 years ago
|
||
Attachment #713119 -
Flags: review?(mounir)
Assignee | ||
Comment 3•11 years ago
|
||
Attachment #713119 -
Attachment is obsolete: true
Attachment #713119 -
Flags: review?(mounir)
Attachment #713140 -
Flags: review?(mounir)
Updated•11 years ago
|
Attachment #713140 -
Attachment is patch: true
Comment 4•11 years ago
|
||
Comment on attachment 713140 [details] [diff] [review] patch + comments requested in bug 838256 comment 13 Review of attachment 713140 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/html/content/src/nsHTMLInputElement.h @@ +674,5 @@ > /** > * Returns the input's "maximum" (as defined by the HTML5 spec) as a double. > * Note this takes account of any default maximum that the type may have. > * Returns NaN if the max attribute isn't a valid floating point number and > + * the input's type does not have a default maximum. Otherwise, guaranteed trailing whitespace
Updated•11 years ago
|
Attachment #713140 -
Flags: review?(mounir) → review+
Assignee | ||
Comment 5•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/ca6fb08cb6a2
Comment 6•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/ca6fb08cb6a2
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
You need to log in
before you can comment on or make changes to this bug.
Description
•