RESOLVED FIXED 237573
Remove invalid ASSERT in LocaleIDBuilder::overrideLanguageScriptRegion().
https://bugs.webkit.org/show_bug.cgi?id=237573
Summary Remove invalid ASSERT in LocaleIDBuilder::overrideLanguageScriptRegion().
Mark Lam
Reported 2022-03-07 18:22:44 PST
localeIDBufferForLanguageTagWithNullTerminator() uses uloc_forLanguageTag, and uloc_forLanguageTag can return an empty (0 length) localeID. LocaleIDBuilder::initialize() uses localeIDBufferForLanguageTagWithNullTerminator() to return a buffer sized based on the localeID it contains. However, when the localeID is not found, we currently erroneously return a non-empty buffer. This patch fixes this by adding a length check, and returning an empty buffer if the localeID length is 0. rdar://83326232
Attachments
proposed patch. (3.18 KB, patch)
2022-03-07 18:29 PST, Mark Lam
mark.lam: review-
[fast-cq] proposed patch. (2.86 KB, patch)
2022-03-07 20:08 PST, Mark Lam
no flags
Mark Lam
Comment 1 2022-03-07 18:23:14 PST
Mark Lam
Comment 2 2022-03-07 18:29:36 PST
Created attachment 454059 [details] proposed patch.
Yusuke Suzuki
Comment 3 2022-03-07 18:32:59 PST
Comment on attachment 454059 [details] proposed patch. r=me
Mark Lam
Comment 4 2022-03-07 19:21:16 PST
Comment on attachment 454059 [details] proposed patch. Looks like my fix is wrong. Will investigate.
Mark Lam
Comment 5 2022-03-07 20:03:29 PST
Turns out the ASSERT(length) in LocaleIDBuilder::overrideLanguageScriptRegion() is simply incorrect. The length can be 0 if uloc_forLanguageTag returns a 0 length in localeIDBufferForLanguageTagWithNullTerminator(). LocaleIDBuilder::overrideLanguageScriptRegion() already handles this scenario correctly. We just need to remove this incorrect ASSERT.
Mark Lam
Comment 6 2022-03-07 20:08:36 PST
Created attachment 454064 [details] [fast-cq] proposed patch.
Yusuke Suzuki
Comment 7 2022-03-07 20:14:42 PST
Comment on attachment 454064 [details] [fast-cq] proposed patch. r=me
Mark Lam
Comment 8 2022-03-08 01:07:17 PST
Comment on attachment 454064 [details] [fast-cq] proposed patch. Thanks for the review. Landing now.
EWS
Comment 9 2022-03-08 01:10:35 PST
Committed r290981 (248159@main): <https://commits.webkit.org/248159@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 454064 [details].
Note You need to log in before you can comment on or make changes to this bug.