Commit 7ffdf821 authored by Frank Tang's avatar Frank Tang Committed by Commit Bot

[Intl] Fix Null-dereference in CreateICUDateFormatFromCache

Bug: chromium:930304
Change-Id: I7793f83b3f3e9aeaa3ecf114c6064773257e90e8
Reviewed-on: https://chromium-review.googlesource.com/c/1461167Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59587}
parent 75498793
......@@ -924,7 +924,10 @@ class DateFormatCache {
if (map_.size() > 8) { // Cache at most 8 DateFormats.
map_.clear();
}
map_[key] = CreateICUDateFormat(icu_locale, skeleton, generator);
std::unique_ptr<icu::SimpleDateFormat> instance(
CreateICUDateFormat(icu_locale, skeleton, generator));
if (instance.get() == nullptr) return nullptr;
map_[key] = std::move(instance);
return static_cast<icu::SimpleDateFormat*>(map_[key]->clone());
}
......
// 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.
assertDoesNotThrow(() => Intl.DateTimeFormat('en-u-nu-ethi'));
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