From 8574ecf2b7a4d2030729f2e31389111a0cdc7dc0 Mon Sep 17 00:00:00 2001 From: Frank Tang Date: Tue, 10 Sep 2019 11:54:43 -0700 Subject: [PATCH] Remove CHECK which fail while the locale is long. Bug: chromium:997401 Change-Id: I7a78f4ad1fd05ab2bb2dbcd343060b2647aef4e6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1771954 Commit-Queue: Frank Tang Reviewed-by: Jakob Kummerow Cr-Commit-Position: refs/heads/master@{#63660} --- src/objects/intl-objects.cc | 7 ++++++- test/intl/regress-997401.js | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 test/intl/regress-997401.js diff --git a/src/objects/intl-objects.cc b/src/objects/intl-objects.cc index dbf212aaf8..cbc7c5d47b 100644 --- a/src/objects/intl-objects.cc +++ b/src/objects/intl-objects.cc @@ -1693,7 +1693,12 @@ std::map LookupAndValidateUnicodeExtensions( status = U_ZERO_ERROR; icu_locale->setUnicodeKeywordValue( bcp47_key == nullptr ? keyword : bcp47_key, nullptr, status); - CHECK(U_SUCCESS(status)); + // Ignore failures in ICU and skip to the next keyword. + // + // This is fine.™ + if (U_FAILURE(status)) { + status = U_ZERO_ERROR; + } } return extensions; diff --git a/test/intl/regress-997401.js b/test/intl/regress-997401.js new file mode 100644 index 0000000000..4c46acff7d --- /dev/null +++ b/test/intl/regress-997401.js @@ -0,0 +1,7 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Test no crash with a very long locale. +let dtf = new Intl.DateTimeFormat( + 'de-u-cu-eur-em-default-hc-h23-ks-level1-lb-strict-lw-normal-ms-metric-nu-latn-rg-atzzzz-sd-atat1-ss-none-tz-atvie-va-posix');