diff --git a/src/runtime/GlobalObjectBuiltinIntl.cpp b/src/runtime/GlobalObjectBuiltinIntl.cpp index 6e29d67b6..70d8d7798 100644 --- a/src/runtime/GlobalObjectBuiltinIntl.cpp +++ b/src/runtime/GlobalObjectBuiltinIntl.cpp @@ -775,7 +775,7 @@ static IntlMatcherResult lookupMatcher(ExecutionState& state, const Vectorfind(String::fromASCII("-u-")); RELEASE_ASSERT(extensionIndex != SIZE_MAX); - size_t extensionLength = locale->length() - extensionIndex; + size_t extensionLength = locale->length(); size_t end = extensionIndex + 3; while (end < locale->length()) { end = locale->find(String::fromASCII("-"), end); diff --git a/test/regression-tests/issue-237.js b/test/regression-tests/issue-237.js new file mode 100644 index 000000000..858b2eba4 --- /dev/null +++ b/test/regression-tests/issue-237.js @@ -0,0 +1,20 @@ +/* Copyright 2019-present Samsung Electronics Co., Ltd. and other contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Copyright 2016 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. + +Intl.NumberFormat('en-u-foo-U-foo')