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
<rdar://problem/83326232>
Created attachment 454059 [details] proposed patch.
Comment on attachment 454059 [details] proposed patch. r=me
Comment on attachment 454059 [details] proposed patch. Looks like my fix is wrong. Will investigate.
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.
Created attachment 454064 [details] [fast-cq] proposed patch.
Comment on attachment 454064 [details] [fast-cq] proposed patch. r=me
Comment on attachment 454064 [details] [fast-cq] proposed patch. Thanks for the review. Landing now.
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].