Fix Use-of-uninitialized-value
v8::internal::JSDateTimeFormat::New Bug: chromium:1177812, chromium:1177623 Change-Id: I91e6babd796c6735e96e3cd1541d8aba51aaefee Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2706353 Commit-Queue: Frank Tang <ftang@chromium.org> Reviewed-by: Shu-yu Guo <syg@chromium.org> Cr-Commit-Position: refs/heads/master@{#72878}
This commit is contained in:
parent
e01256e7d9
commit
00038e19ca
@ -437,7 +437,7 @@ std::string CanonicalizeTimeZoneID(const std::string& input) {
|
||||
title[1] = 'S';
|
||||
}
|
||||
return title;
|
||||
} else if (memcmp(upper.c_str(), "SYSTEMV/", 8) == 0) {
|
||||
} else if (strncmp(upper.c_str(), "SYSTEMV/", 8) == 0) {
|
||||
upper.replace(0, 8, "SystemV/");
|
||||
return upper;
|
||||
}
|
||||
|
5
test/intl/regress-1177623.js
Normal file
5
test/intl/regress-1177623.js
Normal file
@ -0,0 +1,5 @@
|
||||
// Copyright 2021 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.
|
||||
|
||||
assertEquals("UTC", Intl.DateTimeFormat('en', { timeZone: 'Zulu' }).resolvedOptions().timeZone);
|
7
test/intl/regress-1177812.js
Normal file
7
test/intl/regress-1177812.js
Normal file
@ -0,0 +1,7 @@
|
||||
// Copyright 2021 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.
|
||||
|
||||
for (let tz of [ false, [], {}, function () {}]) {
|
||||
assertThrows(() => new Date().toLocaleString(undefined, { timeZone: tz }), RangeError);
|
||||
}
|
Loading…
Reference in New Issue
Block a user