Commit 08f7c10e authored by machenbach's avatar machenbach Committed by Commit bot

Revert of Throw when case mapping result > max string length (patchset #3...

Revert of Throw when case mapping result > max string length (patchset #3 id:40001 of https://codereview.chromium.org/2236593002/ )

Reason for revert:
The test is very flaky and made it on many configurations into the top 10 of the slowest tests:

https://build.chromium.org/p/client.v8.ports/builders/V8%20Arm/builds/845
https://build.chromium.org/p/client.v8/builders/V8%20Win32%20-%20nosnap%20-%20shared/builds/15418
https://build.chromium.org/p/client.v8/builders/V8%20Linux/builds/12369/steps/Check/logs/durations

Original issue's description:
> Throw when case mapping result > max string length
>
> Throw 'Range Error: invalid string length' when the result of
> case mapping is longer than the max string length (kMaxLength in
> objects.h = 1 << 28 - 16).
>
> This is for case mapping with ICU.
>
> BUG=v8:5271
> TEST=intl/general/case-mapping.js with --icu_case_mapping
>
> Committed: https://crrev.com/c7a2046670468b900b9dbbb4ce45beb5e0e717fd
> Cr-Commit-Position: refs/heads/master@{#38565}

TBR=littledan@chromium.org,jshin@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:5271

Review-Url: https://codereview.chromium.org/2236393002
Cr-Commit-Position: refs/heads/master@{#38582}
parent 7ad2de17
......@@ -859,8 +859,8 @@ MUST_USE_RESULT Object* LocaleConvertCase(Handle<String> s, Isolate* isolate,
// This is not a real loop. It'll be executed only once (no overflow) or
// twice (overflow).
for (int i = 0; i < 2; ++i) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result, isolate->factory()->NewRawTwoByteString(dest_length));
result =
isolate->factory()->NewRawTwoByteString(dest_length).ToHandleChecked();
DisallowHeapAllocation no_gc;
String::FlatContent flat = s->GetFlatContent();
const UChar* src = GetUCharBufferFromFlat(flat, &sap, src_length);
......
......@@ -136,30 +136,3 @@ assertEquals("\u{10CC0}", "\u{10C80}".toLocaleLowerCase());
assertEquals("\u{10C80}", "\u{10CC0}".toLocaleUpperCase(["tr"]));
assertEquals("\u{10C80}", "\u{10CC0}".toLocaleUpperCase(["tr"]));
assertEquals("\u{10CC0}", "\u{10C80}".toLocaleLowerCase());
// If the result of case mapping is longer than the max string length
// (1<<28 - 16), it should throw a range error instead of crashing.
var invalidValues = [
{ c: "\u0390", opType: 0 },
{ c: "ß", opType: 0 },
{ c: "\uFB01", opType: 0 }, // fi ligature
{ c: "\uFB04", opType: 0 }, // ffl ligature
{ c: "\u0390", opType: 1, locale: "und" },
{ c: "\u00CC", opType: 2, locale: "lt" },
{ c: "\u0130", opType: 2, locale: "en" },
];
for (var {c, opType, locale} of invalidValues) {
var s = c.repeat(1<<27);
switch (opType) {
case 0:
assertThrows(() => s.toUpperCase(), RangeError);
break;
case 1:
assertThrows(() => s.toLocaleUpperCase(locale), RangeError);
break;
case 2:
assertThrows(() => s.toLocaleLowerCase(locale), RangeError);
break;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment