Closed Bug 856265 Opened 8 years ago Closed 7 years ago
"ASSERTION: index exceeds allowable range" - mozilla::dom::HTMLInput
Element::Get Value As Date
With: user_pref("dom.experimental_forms", true); The testcase triggers: ###!!! ASSERTION: index exceeds allowable range: 'i < mLength', file nsTSubstring.h, line 229
>3607 uint32_t endOfYearOffset = 0; >3608 for (; NS_IsAsciiDigit(aValue[endOfYearOffset]); ++endOfYearOffset); This code is just wrong....
This should do the trick. The requirements are pretty restrictive so we know exactly where the '-' symbols should be.
Attachment #8388129 - Flags: review?(jst)
Comment on attachment 8388129 [details] [diff] [review] Fix HTMLInputElement::GetValueAsDate to accept long string of numbers as input Looks good to me, r=jst!
Attachment #8388129 - Flags: review?(jst) → review+
Can someone assign this bug to me? I need it to set "checkin-needed" keyword and the status later, I think. Thanks!
Backed out in https://hg.mozilla.org/integration/mozilla-inbound/rev/3cb985aa114c because https://tbpl.mozilla.org/php/getParsedLog.php?id=36914436&tree=Mozilla-Inbound, couple of tests seem to disagree with you about whether -1970 and 123 are reasonable years.
Oh I'm very sorry about this! The problem is that the code assumes the year string is composed only of ASCII number characters in here *aYear = PromiseFlatString(StringHead(aValue, endOfYearOffset)).ToInteger(&ec); and so " 123" is an acceptable four-digit number. Changing this to *aYear = PromiseFlatString(StringHead(aValue, endOfYearOffset)).ToInteger(&ec); should fix this. I ran mochitest-simple on my machine and everything seems fine, but it's probably better if someone could push it to the try server since I don't have access yet! (working on the application) Thank you!
I meant changing to if (!DigitSubStringToNumber(aValue, 0, endOfYearOffset, aYear) || sorry for the double post.
Comment on attachment 8400381 [details] [diff] [review] Fix HTMLInputElement::GetValueAsDate to accept long string of numbers as input r=jst, and please push to try before landing now that you have access :)
Attachment #8400381 - Flags: review?(jst) → review+
I'm very sorry to bug you again about this Johnny, I misunderstood the spec, four digits means four digits ("0001" is ok) while I thought it was 1000 or more. I've already pushed this for Mochitest here: https://tbpl.mozilla.org/?tree=Try&rev=6f866542e36f And there's a full test here (please let me know if I should avoid doing full test if I'm confident enough) https://tbpl.mozilla.org/?tree=Try&rev=bcb1fbcf1461 Please let me know if you think I should update test case as well. Thanks!
Whiteboard: [fuzzblocker] → checkin-needed
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.