Skip to content

IntlCollator: throw an OutOfMemoryError instead of crashing when a huge Latin-1 string needs the UTF-16 upconversion - #500

Open
robobun wants to merge 1 commit into
mainfrom
farm/bf2da5cd/intl-collator-huge-latin1-oom
Open

IntlCollator: throw an OutOfMemoryError instead of crashing when a huge Latin-1 string needs the UTF-16 upconversion#500
robobun wants to merge 1 commit into
mainfrom
farm/bf2da5cd/intl-collator-huge-latin1-oom

Conversation

@robobun

@robobun robobun commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Problem

  • "a".repeat(1 << 30).localeCompare("\u3042") kills the process. The fuzzer found it in Bun with "DELETE".padEnd(1073741824).localeCompare(buffer), where the buffer's string form is 16-bit.
  • IntlCollator::compareStrings() falls back to ucol_strcoll() when none of the ASCII fast paths apply. That path calls StringView::upconvertedCharacters() on both operands. For a Latin-1 string of 1 << 30 or more characters the Vector<char16_t> behind it is past isValidCapacityForVector<char16_t>, and allocateBuffer<FailureAction::Crash> hits CRASH() (Vector.h:228).
  • The same length is a valid JS string (JSString::MaxLength is INT32_MAX), and a 16-bit operand of the same length compares fine. Only the Latin-1 upconversion has the lower limit.

Fix

  • Before the ucol_strcoll() fallback, check that each 8-bit operand fits isValidCapacityForVector<char16_t>. If not, throw OutOfMemoryError (RangeError: Out of memory). This is what String.prototype.normalize() already does for an input of that size (the rdar://160634825 check in StringPrototype.cpp).
  • The fast paths are untouched: huge ASCII operands on both sides still compare without an allocation.
  • JSTests/stress/intl-collator-compare-huge-latin1-string.js covers localeCompare in both argument positions, the default Intl.Collator, and a collator with options (no UCA DUCET fast path). The second operand is 16-bit so the test does not scan the 1 GiB string. Skipped when $memoryLimited.

The branch is rebased on ceb9f90fb774, the WebKit Bun currently pins, so the preview build carries only this change.

Bun side: oven-sh/bun#40253 pins the preview build and adds the regression test.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f97b6598-2531-4ff5-9017-6bb1e57cee22

📥 Commits

Reviewing files that changed from the base of the PR and between 0bb01ed and de1149f.

📒 Files selected for processing (2)
  • JSTests/stress/intl-collator-compare-huge-latin1-string.js
  • Source/JavaScriptCore/runtime/IntlCollator.cpp

Included review availability: Your plan provides up to 5 included reviews per hour; 0 remain after this review.


Walkthrough

Changes

Intl collator OOM protection

Layer / File(s) Summary
Conversion guard and stress coverage
Source/JavaScriptCore/runtime/IntlCollator.cpp, JSTests/stress/intl-collator-compare-huge-latin1-string.js
IntlCollator::compareStrings checks UTF-16 upconversion capacity before the ICU fallback. Oversized Latin-1 inputs throw RangeError: Out of memory. The stress test covers localeCompare, Intl.Collator, comparison options, and operand orders.

Merge Risk: ⚪ Minimal · up to de114

This localized change converts a crash into an OutOfMemoryError for oversized Latin-1 collation inputs and adds regression coverage; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 2 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The description references a Bun issue but does not provide the required WebKit Bugzilla issue link for this change. Associate the pull request with the relevant WebKit Bugzilla issue and add its URL to the pull request description.
Description check ⚠️ Warning The description explains the problem, root cause, fix, test coverage, fast-path behavior, and related Bun change. It does not provide the required WebKit Bugzilla URL or the template's Reviewed by lin… Add the WebKit Bugzilla issue URL, include the required "Reviewed by NOBODY (OOPS!)." line or an actual reviewer, and list the changed paths and relevant functions in the required template format. Ensure the pull request is linked from Bugz…
✅ Passed checks (2 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed The code change and regression test directly support the stated objective. The Bun reference provides integration context and does not indicate an unrelated change.
Title check ✅ Passed The title clearly identifies the main change: preventing crashes by throwing an out-of-memory error for huge Latin-1 strings during UTF-16 upconversion.
Full details: Description check

Explanation

The description explains the problem, root cause, fix, test coverage, fast-path behavior, and related Bun change. It does not provide the required WebKit Bugzilla URL or the template's Reviewed by line and changed-file/function list.

Resolution

Add the WebKit Bugzilla issue URL, include the required "Reviewed by NOBODY (OOPS!)." line or an actual reviewer, and list the changed paths and relevant functions in the required template format. Ensure the pull request is linked from Bugzilla and has the required labels and assignment if applicable.

  • Fix all pre-merge checks with AI

Warning

Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use path_filters to narrow the review scope.


Comment @coderabbitai help to get the list of available commands.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — small, targeted crash fix that turns a Vector capacity CRASH() into a catchable OutOfMemoryError.

What was reviewed:

  • Verified isValidCapacityForVector<char16_t> threshold is (UINT_MAX >> 1) / 2, so 1 << 30 correctly triggers the guard.
  • Confirmed UpconvertedCharactersWithSize uses Vector<char16_t>::grow() which would CRASH() at that size — the guard is placed correctly.
  • Checked both callers (IntlCollatorPrototype.cpp:107, StringPrototype.cpp:1797) use RELEASE_AND_RETURN, so the thrown exception propagates and the return { } value is never observed.
  • Matches the existing rdar://160634825 precedent in StringPrototype.cpp and the existing U_FAILURE error path in this same function.
Extended reasoning...

Overview

This PR adds a pre-flight capacity check in IntlCollator::compareStrings() before the ucol_strcoll() fallback path calls StringView::upconvertedCharacters(). When an 8-bit operand is ≥ 1 << 30 characters, the backing Vector<char16_t> cannot hold it (isValidCapacityForVector<char16_t> caps at 0x3FFFFFFF), and allocateBuffer<FailureAction::Crash> would hit CRASH(). The fix throws OutOfMemoryError instead. A stress test covers localeCompare and Intl.Collator().compare in both argument positions.

Security risks

None. This is a defensive bounds check that converts a process crash into a JS-level RangeError. No new data flows, no parsing of untrusted input beyond what already existed, and the check is purely a length comparison against a compile-time constant.

Level of scrutiny

Low-to-moderate. The change is ~10 lines in a single function, follows an established in-tree precedent (the rdar://160634825 check in StringPrototype.cpp:2188-2192), and reuses the exact error-handling pattern already present two lines below (throwException + return { }). The fast paths (ASCII UCA DUCET, ucol_strcollUTF8) are untouched, so there is no behavior change for normal-sized inputs.

Other factors

  • Verified the math: isValidCapacityForVector<char16_t>(n) = n <= (0x7FFFFFFF / 2) = n <= 0x3FFFFFFF, so the test's 1 << 30 (= 0x40000000) is exactly the first failing size.
  • Verified UpconvertedCharactersWithSize ctor calls m_upconvertedCharacters.grow(string.m_length) on the 8-bit path — the guard is correctly conditioned on is8Bit().
  • Verified both call sites wrap the result in RELEASE_AND_RETURN(scope, ...), so the pending exception propagates and the dummy UCOL_EQUAL return value is never observed by JS — same as the pre-existing U_FAILURE branch.
  • Test is appropriately gated with //@ skip if $memoryLimited since it allocates a 1 GiB string.

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown

Preview Builds

Commit Release Date
345e73d9 autobuild-preview-pr-500-345e73d9 2026-08-28 15:00:24 UTC
53fc653a autobuild-preview-pr-500-53fc653a 2026-08-28 09:56:05 UTC
57344345 autobuild-preview-pr-500-57344345 2026-08-28 08:48:34 UTC
29a935c7 autobuild-preview-pr-500-29a935c7 2026-08-28 03:06:09 UTC
de1149fd autobuild-preview-pr-500-de1149fd 2026-08-27 23:51:56 UTC
e92affad autobuild-preview-pr-500-e92affad 2026-08-27 17:06:18 UTC
1a171c01 autobuild-preview-pr-500-1a171c01 2026-08-26 21:50:00 UTC
0a07044d autobuild-preview-pr-500-0a07044d 2026-08-26 05:50:21 UTC
b0d21d8d autobuild-preview-pr-500-b0d21d8d 2026-08-25 23:29:33 UTC
dddf09e6 autobuild-preview-pr-500-dddf09e6 2026-08-25 10:57:27 UTC
59d0abdc autobuild-preview-pr-500-59d0abdc 2026-08-24 12:04:10 UTC
e173d7f6 autobuild-preview-pr-500-e173d7f6 2026-08-23 21:03:18 UTC

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — small, defensive guard that turns a CRASH() into a catchable RangeError: Out of memory.

What was reviewed:

  • Verified UpconvertedCharactersWithSize backs onto Vector<char16_t>::grow(), and isValidCapacityForVector<char16_t> caps at 0x3FFFFFFF, so 1 << 30 is exactly the first failing length.
  • Confirmed both callers (IntlCollatorPrototype.cpp:107, StringPrototype.cpp:1797) wrap the call in RELEASE_AND_RETURN(scope, …), so the thrown exception propagates and the {} return value is never observed.
  • Matches the existing rdar://160634825 precedent in stringProtoFuncNormalize (StringPrototype.cpp:2188-2192).
  • Fast paths (ASCII DUCET, both-8-bit-ASCII ucol_strcollUTF8) are untouched — the guard only runs on the fallback branch.
Extended reasoning...

Overview

This PR adds a capacity pre-check to IntlCollator::compareStrings() before it calls StringView::upconvertedCharacters() on the ucol_strcoll() fallback path. When an 8-bit operand is ≥ 1 << 30 characters, the backing Vector<char16_t> cannot grow to that size and allocateBuffer<FailureAction::Crash> calls CRASH(). The fix throws OutOfMemoryError instead. A stress test covers localeCompare in both argument orders and both the default and options-configured Intl.Collator.

Security risks

None introduced. The change strictly removes a process-crash denial-of-service vector reachable from untrusted JS ("a".repeat(1<<30).localeCompare("\u3042")). No new allocation, no new user-controlled data flow — just an early bounds check using the same predicate (WTF::isValidCapacityForVector<char16_t>) that Vector::allocateBuffer itself uses at Vector.h:226.

Level of scrutiny

Low-to-moderate. The diff is 9 source lines confined to one function's slow-path fallback. It follows an established pattern already in the codebase — stringProtoFuncNormalize in StringPrototype.cpp:2188-2192 does the same length-guard-then-throwOutOfMemoryError for the same underlying reason. The canUpconvert lambda correctly short-circuits for 16-bit views (which need no upconversion), and the [[unlikely]] annotation is appropriate. Both call sites use RELEASE_AND_RETURN, so the pending exception is handled correctly and the return { } sentinel is never consumed.

Other factors

  • The preview build (autobuild-preview-pr-500-e173d7f6) succeeded, so the explicit WTF:: qualification and header availability are confirmed by CI.
  • The regression test is properly gated with //@ skip if $memoryLimited and forces the fallback path by pairing the huge Latin-1 string with a 16-bit operand, avoiding the ASCII fast paths.
  • No outstanding reviewer comments; CodeRabbit was rate-limited and did not review.

robobun added a commit to oven-sh/bun that referenced this pull request Aug 24, 2026
… crashing

Points WEBKIT_VERSION at the preview build of oven-sh/WebKit#500.

IntlCollator::compareStrings() falls back to ucol_strcoll() when none of
the ASCII fast paths apply. That path upconverts each Latin-1 operand to
UTF-16 through a Vector<char16_t>. A string of 2^30 or more characters is
past the Vector's maximum capacity, and the allocation CRASH()ed the
process. The WebKit change throws RangeError: Out of memory instead.

Repro: "a".repeat(2 ** 30).localeCompare("\u3042").
@robobun
robobun force-pushed the farm/bf2da5cd/intl-collator-huge-latin1-oom branch from 59d0abd to dddf09e Compare August 25, 2026 09:36

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — small, targeted fix that converts a hard CRASH() into a JS RangeError: Out of memory.

What was reviewed:

  • The canUpconvert guard uses the same isValidCapacityForVector<char16_t> predicate that VectorBufferBase::allocateBuffer checks before crashing, and only applies to 8-bit views (16-bit views are passed through without copying in UpconvertedCharactersWithSize).
  • Error-path shape matches the existing U_FAILURE branch in the same function (throw...; return { };) and both callers wrap the result in RELEASE_AND_RETURN(scope, ...), so the pending exception propagates correctly.
  • Mirrors the existing rdar://160634825 precedent in normalize() (StringPrototype.cpp:2188-2192).
  • Fast paths (ASCII UCA DUCET, both-8-bit ucol_strcollUTF8) are untouched — the check only runs on the fallback that would allocate.
Extended reasoning...

Overview

This PR modifies one function, IntlCollator::compareStrings() in Source/JavaScriptCore/runtime/IntlCollator.cpp, adding a 7-line capacity check before the ucol_strcoll() fallback path. It also adds a stress test at JSTests/stress/intl-collator-compare-huge-latin1-string.js.

The bug: when neither ASCII fast path applies, the function calls x.upconvertedCharacters() / y.upconvertedCharacters(). For an 8-bit StringView, UpconvertedCharactersWithSize grows a Vector<char16_t, 32> to view.length(). VectorBufferBase::allocateBuffer<FailureAction::Crash> calls CRASH() when !isValidCapacityForVector<char16_t>(newCapacity) (i.e., length > 0x3FFFFFFF). Since JSString::MaxLength is INT32_MAX, a valid Latin-1 JS string of 1 << 30 characters or more triggers this. The fix pre-checks the same predicate and throws OutOfMemoryError instead.

Security risks

None introduced. This is strictly defensive: it replaces a process crash with a catchable JS exception. No new allocation paths, no user-controlled data flowing anywhere new. The check is only on view.length(), an unsigned integer already bounded by JSString::MaxLength.

Level of scrutiny

Low-to-moderate. The change is 7 lines inside a single function, only reachable when the existing fast paths bail out, and only fires for strings ≥ 1 GiB in the 8-bit representation — a case that previously crashed unconditionally. The !view.is8Bit() short-circuit correctly skips 16-bit views (which UpconvertedCharactersWithSize handles without allocating, per StringView.h:683-685). The error-return shape (throwOutOfMemoryError(...); return { };) is identical to the pre-existing U_FAILURE branch three lines below, and both call sites (IntlCollatorPrototype.cpp:107, StringPrototype.cpp:1797) use RELEASE_AND_RETURN so the exception propagates. There is direct precedent for this exact pattern at StringPrototype.cpp:2188-2192 (rdar://160634825).

Other factors

  • Regression test covers both argument positions of localeCompare, the default Intl.Collator, and a collator with { sensitivity: "base" } (which disables the UCA DUCET fast path). It is //@ skip if $memoryLimited, consistent with other 1 GiB stress tests.
  • The bug hunting system found no issues.
  • No prior human review comments to address; only bot comments (coderabbit rate-limit notice, preview build links) on the timeline.

robobun added a commit to oven-sh/bun that referenced this pull request Aug 25, 2026
… crashing

Points WEBKIT_VERSION at the preview build of oven-sh/WebKit#500.

IntlCollator::compareStrings() falls back to ucol_strcoll() when none of
the ASCII fast paths apply. That path upconverts each Latin-1 operand to
UTF-16 through a Vector<char16_t>. A string of 2^30 or more characters is
past the Vector's maximum capacity, and the allocation CRASH()ed the
process. The WebKit change throws RangeError: Out of memory instead.

Repro: "a".repeat(2 ** 30).localeCompare("\u3042").
@robobun
robobun force-pushed the farm/bf2da5cd/intl-collator-huge-latin1-oom branch from dddf09e to b0d21d8 Compare August 25, 2026 22:00

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — targeted crash fix that turns a Vector capacity CRASH() into a catchable OutOfMemoryError.

What was reviewed:

  • Verified isValidCapacityForVector<char16_t> is the exact predicate Vector::allocateBuffer checks before CRASH()ing, so the guard matches the failure condition precisely.
  • Confirmed both callers (IntlCollatorPrototype.cpp:107, StringPrototype.cpp:1797) use RELEASE_AND_RETURN, so the thrown exception propagates — same as the existing U_FAILURE throw path just below.
  • The !view.is8Bit() early-out is correct: 16-bit views pass through upconvertedCharacters() without allocation.
  • Fast paths (ASCII DUCET, both-8-bit-ASCII ucol_strcollUTF8) are untouched; the check only runs on the fallback path.
Extended reasoning...

Overview

The PR adds a 9-line guard in IntlCollator::compareStrings() (Source/JavaScriptCore/runtime/IntlCollator.cpp) plus a stress test. Before falling back to ucol_strcoll(), which requires UTF-16 and calls StringView::upconvertedCharacters() on both operands, it checks whether an 8-bit operand's length would exceed Vector<char16_t>'s maximum capacity. If so, it throws OutOfMemoryError instead of letting Vector::allocateBuffer<FailureAction::Crash> hit CRASH().

Security risks

None. This converts an unconditional process crash into a catchable JS RangeError. No new inputs are trusted, no new allocation paths are added, and the length check is purely arithmetic on an unsigned length. If anything this is a robustness/DoS improvement — a script can no longer kill the process via "a".repeat(1<<30).localeCompare("\u3042").

Level of scrutiny

Low-to-moderate. The change is confined to a single fallback branch inside one function, uses the same throw-and-return-{} pattern as the pre-existing U_FAILURE handler two lines below, and mirrors the precedent cited in the PR description (String.prototype.normalize at StringPrototype.cpp:2188-2192). I checked Vector.h:212 to confirm isValidCapacityForVector<T> is the exact predicate the Vector allocation path uses ((UINT_MAX >> 1) / sizeof(T), i.e. 0x3FFFFFFF for char16_t), so the guard is neither too tight nor too loose relative to the crash it prevents.

Other factors

  • Both call sites wrap the result in RELEASE_AND_RETURN(scope, ...), so the thrown exception propagates correctly even though a dummy UCOL_EQUAL is returned — identical to how the existing ICU-failure branch already behaves.
  • The [[unlikely]] annotation and the !view.is8Bit() short-circuit keep the hot path cost negligible.
  • A dedicated stress test exercises both argument positions, the default collator, and a collator with options that disables the DUCET fast path; it is gated on $memoryLimited.
  • No prior human or bot review comments to address; no CODEOWNERS implicated for a localized runtime bugfix of this size.

robobun added a commit to oven-sh/bun that referenced this pull request Aug 25, 2026
… crashing

Points WEBKIT_VERSION at the preview build of oven-sh/WebKit#500.

IntlCollator::compareStrings() falls back to ucol_strcoll() when none of
the ASCII fast paths apply. That path upconverts each Latin-1 operand to
UTF-16 through a Vector<char16_t>. A string of 2^30 or more characters is
past the Vector's maximum capacity, and the allocation CRASH()ed the
process. The WebKit change throws RangeError: Out of memory instead.

Repro: "a".repeat(2 ** 30).localeCompare("\u3042").
@robobun
robobun force-pushed the farm/bf2da5cd/intl-collator-huge-latin1-oom branch from b0d21d8 to 0a07044 Compare August 26, 2026 04:51

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

robobun added a commit to oven-sh/bun that referenced this pull request Aug 26, 2026
… crashing

Points WEBKIT_VERSION at the preview build of oven-sh/WebKit#500.

IntlCollator::compareStrings() falls back to ucol_strcoll() when none of
the ASCII fast paths apply. That path upconverts each Latin-1 operand to
UTF-16 through a Vector<char16_t>. A string of 2^30 or more characters is
past the Vector's maximum capacity, and the allocation CRASH()ed the
process. The WebKit change throws RangeError: Out of memory instead.

Repro: "a".repeat(2 ** 30).localeCompare("\u3042").
@robobun
robobun force-pushed the farm/bf2da5cd/intl-collator-huge-latin1-oom branch from 0a07044 to 1a171c0 Compare August 26, 2026 21:17

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

robobun added a commit to oven-sh/bun that referenced this pull request Aug 26, 2026
… crashing

Points WEBKIT_VERSION at the preview build of oven-sh/WebKit#500.

IntlCollator::compareStrings() falls back to ucol_strcoll() when none of
the ASCII fast paths apply. That path upconverts each Latin-1 operand to
UTF-16 through a Vector<char16_t>. A string of 2^30 or more characters is
past the Vector's maximum capacity, and the allocation CRASH()ed the
process. The WebKit change throws RangeError: Out of memory instead.

Repro: "a".repeat(2 ** 30).localeCompare("\u3042").
@robobun
robobun force-pushed the farm/bf2da5cd/intl-collator-huge-latin1-oom branch from 1a171c0 to e30c7ff Compare August 27, 2026 09:50

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

@robobun

robobun commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator Author

The preview build for e30c7ff4 (run 33060354204) fails in Build / Windows (windows-11-arm, Debug, arm64) at the step Install LLVM and Ninja (ARM64), about ten seconds into the job, before checkout. A re-run of the failed job fails the same way. Every preview build started since about 09:48 UTC today fails at that same step (for example runs 33060352752, 33060284775, 33060250463), so this is the runner or the toolchain download, not this branch. The same job passed for the previous head 1a171c01 yesterday. This token cannot read the job log.

Until that job passes, no autobuild-preview-pr-500-e30c7ff4 release exists, and oven-sh/bun#40253 cannot move to it.

@robobun
robobun force-pushed the farm/bf2da5cd/intl-collator-huge-latin1-oom branch from e30c7ff to e92affa Compare August 27, 2026 16:22

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

robobun added a commit to oven-sh/bun that referenced this pull request Aug 27, 2026
… crashing

Points WEBKIT_VERSION at the preview build of oven-sh/WebKit#500.

IntlCollator::compareStrings() falls back to ucol_strcoll() when none of
the ASCII fast paths apply. That path upconverts each Latin-1 operand to
UTF-16 through a Vector<char16_t>. A string of 2^30 or more characters is
past the Vector's maximum capacity, and the allocation CRASH()ed the
process. The WebKit change throws RangeError: Out of memory instead.

Repro: "a".repeat(2 ** 30).localeCompare("\u3042").
@robobun
robobun force-pushed the farm/bf2da5cd/intl-collator-huge-latin1-oom branch from e92affa to de1149f Compare August 27, 2026 23:22

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

robobun added a commit to oven-sh/bun that referenced this pull request Aug 27, 2026
… crashing

Points WEBKIT_VERSION at the preview build of oven-sh/WebKit#500.

IntlCollator::compareStrings() falls back to ucol_strcoll() when none of
the ASCII fast paths apply. That path upconverts each Latin-1 operand to
UTF-16 through a Vector<char16_t>. A string of 2^30 or more characters is
past the Vector's maximum capacity, and the allocation CRASH()ed the
process. The WebKit change throws RangeError: Out of memory instead.

Repro: "a".repeat(2 ** 30).localeCompare("\u3042").
@robobun
robobun force-pushed the farm/bf2da5cd/intl-collator-huge-latin1-oom branch from de1149f to 29a935c Compare August 28, 2026 02:08

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

robobun added a commit to oven-sh/bun that referenced this pull request Aug 28, 2026
… crashing

Points WEBKIT_VERSION at the preview build of oven-sh/WebKit#500.

IntlCollator::compareStrings() falls back to ucol_strcoll() when none of
the ASCII fast paths apply. That path upconverts each Latin-1 operand to
UTF-16 through a Vector<char16_t>. A string of 2^30 or more characters is
past the Vector's maximum capacity, and the allocation CRASH()ed the
process. The WebKit change throws RangeError: Out of memory instead.

Repro: "a".repeat(2 ** 30).localeCompare("\u3042").
@robobun
robobun force-pushed the farm/bf2da5cd/intl-collator-huge-latin1-oom branch from 29a935c to 5734434 Compare August 28, 2026 08:10

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

robobun added a commit to oven-sh/bun that referenced this pull request Aug 28, 2026
… crashing

Points WEBKIT_VERSION at the preview build of oven-sh/WebKit#500.

IntlCollator::compareStrings() falls back to ucol_strcoll() when none of
the ASCII fast paths apply. That path upconverts each Latin-1 operand to
UTF-16 through a Vector<char16_t>. A string of 2^30 or more characters is
past the Vector's maximum capacity, and the allocation CRASH()ed the
process. The WebKit change throws RangeError: Out of memory instead.

Repro: "a".repeat(2 ** 30).localeCompare("\u3042").
@robobun
robobun force-pushed the farm/bf2da5cd/intl-collator-huge-latin1-oom branch from 5734434 to 53fc653 Compare August 28, 2026 08:55

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

robobun added a commit to oven-sh/bun that referenced this pull request Aug 28, 2026
… crashing

Points WEBKIT_VERSION at the preview build of oven-sh/WebKit#500.

IntlCollator::compareStrings() falls back to ucol_strcoll() when none of
the ASCII fast paths apply. That path upconverts each Latin-1 operand to
UTF-16 through a Vector<char16_t>. A string of 2^30 or more characters is
past the Vector's maximum capacity, and the allocation CRASH()ed the
process. The WebKit change throws RangeError: Out of memory instead.

Repro: "a".repeat(2 ** 30).localeCompare("\u3042").
…ge Latin-1 string needs the UTF-16 upconversion

IntlCollator::compareStrings() falls back to ucol_strcoll() when none of
the ASCII fast paths apply. That path calls
StringView::upconvertedCharacters() on both operands. For a Latin-1
string of 1 << 30 or more characters, the Vector<char16_t> behind it is
past its maximum capacity (isValidCapacityForVector<char16_t>) and
CRASH()es.

"a".repeat(1 << 30).localeCompare("\u3042") killed the process. It now
throws RangeError: Out of memory, the same way String.prototype.normalize()
already handles an input of that size.
@robobun
robobun force-pushed the farm/bf2da5cd/intl-collator-huge-latin1-oom branch from 53fc653 to 345e73d Compare August 28, 2026 14:10

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

robobun added a commit to oven-sh/bun that referenced this pull request Aug 28, 2026
… crashing

Points WEBKIT_VERSION at the preview build of oven-sh/WebKit#500.

IntlCollator::compareStrings() falls back to ucol_strcoll() when none of
the ASCII fast paths apply. That path upconverts each Latin-1 operand to
UTF-16 through a Vector<char16_t>. A string of 2^30 or more characters is
past the Vector's maximum capacity, and the allocation CRASH()ed the
process. The WebKit change throws RangeError: Out of memory instead.

Repro: "a".repeat(2 ** 30).localeCompare("\u3042").
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant