Closed
Bug 1448786
Opened 6 years ago
Closed 6 years ago
Avoid UTF8ToUnicodeBuffer in OSPreferences_win.cpp
Categories
(Core :: Internationalization, enhancement)
Core
Internationalization
Tracking
()
RESOLVED
FIXED
mozilla61
Tracking | Status | |
---|---|---|
firefox61 | --- | fixed |
People
(Reporter: hsivonen, Assigned: hsivonen)
References
Details
Attachments
(1 file)
UTF8ToUnicodeBuffer is going away in bug 1402247 (mostly because after my changes no Linux callers were left and I noticed a Windows caller just now).
Assignee | ||
Comment 1•6 years ago
|
||
Are locale strings arbitrary UTF-8 or are they guaranteed to be ASCII? I.e. can we use a Latin1 to UTF-16 conversion here, which involves no length calculation issues?
Flags: needinfo?(gandalf)
Assignee | ||
Comment 2•6 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #0) > UTF8ToUnicodeBuffer is going away in bug 1402247 (mostly because after my > changes no Linux callers were left and I noticed a Windows caller just now). (Oh, and the new code has very different assumptions about how length calculation happens than what UTF8ToUnicodeBuffer requires.)
Comment 3•6 years ago
|
||
As used here the locale should always be ASCII, but the value comes from JS over XPIDL [0] so we cannot guarantee it wont have some UTF8 in weird cases (but that's always going to be invalid input so its ok if it doesn't match anything, just don't crash :)). [0] https://searchfox.org/mozilla-central/source/intl/locale/mozIOSPreferences.idl#98
Flags: needinfo?(gandalf)
Comment 4•6 years ago
|
||
(In reply to Zibi Braniecki [:gandalf][:zibi] from comment #3) > As used here the locale should always be ASCII, but the value comes from JS > over XPIDL [0] so we cannot guarantee it wont have some UTF8 in weird cases > (but that's always going to be invalid input so its ok if it doesn't match > anything, just don't crash :)). Actually locale can only contain Latin1 characters because it uses ACString. (If it uses AUTF8String or AString, it can contain arbitrary Unicode characters.)
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 7•6 years ago
|
||
AFAICT, we don't need a manually-declared buffer on the stack and relying on the on-stack buffer provided by nsAutoString should be fine.
Assignee | ||
Updated•6 years ago
|
Attachment #8962323 -
Flags: review?(gandalf)
Comment 8•6 years ago
|
||
mozreview-review |
Comment on attachment 8962323 [details] Bug 1448786 - Avoid UTF8ToUnicodeBuffer in OSPreferences_win.cpp. https://reviewboard.mozilla.org/r/231198/#review237424
Attachment #8962323 -
Flags: review?(gandalf) → review+
Pushed by hsivonen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d9f8d12c6d6e Avoid UTF8ToUnicodeBuffer in OSPreferences_win.cpp. r=gandalf
Comment 10•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/d9f8d12c6d6e
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox61:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in
before you can comment on or make changes to this bug.
Description
•