Bug 237573 - Remove invalid ASSERT in LocaleIDBuilder::overrideLanguageScriptRegion().
Summary: Remove invalid ASSERT in LocaleIDBuilder::overrideLanguageScriptRegion().
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-03-07 18:22 PST by Mark Lam
Modified: 2022-03-08 01:10 PST (History)
7 users (show)

See Also:


Attachments
proposed patch. (3.18 KB, patch)
2022-03-07 18:29 PST, Mark Lam
mark.lam: review-
Details | Formatted Diff | Diff
[fast-cq] proposed patch. (2.86 KB, patch)
2022-03-07 20:08 PST, Mark Lam
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 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
Comment 1 Mark Lam 2022-03-07 18:23:14 PST
<rdar://problem/83326232>
Comment 2 Mark Lam 2022-03-07 18:29:36 PST
Created attachment 454059 [details]
proposed patch.
Comment 3 Yusuke Suzuki 2022-03-07 18:32:59 PST
Comment on attachment 454059 [details]
proposed patch.

r=me
Comment 4 Mark Lam 2022-03-07 19:21:16 PST
Comment on attachment 454059 [details]
proposed patch.

Looks like my fix is wrong.  Will investigate.
Comment 5 Mark Lam 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.
Comment 6 Mark Lam 2022-03-07 20:08:36 PST
Created attachment 454064 [details]
[fast-cq] proposed patch.
Comment 7 Yusuke Suzuki 2022-03-07 20:14:42 PST
Comment on attachment 454064 [details]
[fast-cq] proposed patch.

r=me
Comment 8 Mark Lam 2022-03-08 01:07:17 PST
Comment on attachment 454064 [details]
[fast-cq] proposed patch.

Thanks for the review.  Landing now.
Comment 9 EWS 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].