Version comparator returns different results on different platforms in the presence of >32-bit numbers
Categories
(Core :: XPCOM, defect)
Tracking
()
People
(Reporter: mossop, Assigned: mossop)
References
Details
Attachments
(1 file)
47 bytes,
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-beta+
RyanVM
:
approval-mozilla-release+
|
Details | Review |
We use wcstol to parse numbers out of version strings on Windows and strtol elsewhere. The two claim to return the same results. Both say that when the value parsed is too large for a uint32_t they can return LONG_MAX or LONG_MIN. It seems that the two return different ones.
This patch first switches to support 64-bit numbers and then in the unlikely case that a version does overflow it ensures the value is converted to LLONG_MAX.
Assignee | ||
Comment 1•6 years ago
|
||
On second thoughts, switching to 64-bit seems overkill for a rare use-case. And I think it might be better to make an invalid version to match a missing version (0) since if you accidentally end up with an invalid version to compare against it is easy to make another version that is larger or smaller than it, much harder with the int64 limit.
Assignee | ||
Comment 2•6 years ago
|
||
Assignee | ||
Comment 4•6 years ago
|
||
I split the part for bug 1554029 out and landed this.
Assignee | ||
Comment 5•6 years ago
|
||
Comment on attachment 9068228 [details]
Bug 1555179: Use 0 in place of out of range numbers in version comparisons. r=froydnj
Beta/Release Uplift Approval Request
- User impact if declined: This is required for fixing bug 1554029.
- Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): Simple error checking addition. The only affected code would be behaving badly already.
- String changes made/needed: None
Comment 6•6 years ago
|
||
bugherder |
Comment 7•6 years ago
|
||
Comment on attachment 9068228 [details]
Bug 1555179: Use 0 in place of out of range numbers in version comparisons. r=froydnj
Fx67 dot-release blocker. Approved for 68.0b6 and 67.0.1.
Comment 8•6 years ago
|
||
uplift |
This was caught by one of the new automated tests added in bug 1554029 failing, so I don't think there's a need for manual QA validation either.
https://hg.mozilla.org/releases/mozilla-release/rev/4e3b198b1d846e0c30fc079f5e1998ae450b8b12
Updated•6 years ago
|
Comment 9•6 years ago
|
||
bugherder uplift |
Comment 10•5 years ago
|
||
Please specify a root cause for this bug. See :tmaity for more information.
Assignee | ||
Updated•5 years ago
|
Description
•