Commit 9faa2ca7 authored by Kunihiko Sakamoto's avatar Kunihiko Sakamoto Committed by Commit Bot

Fix potential use-after-free in CSSFontFaceSource

This fixes a bug introduced by crrev.com/c/824172.

Bug: 778352
Change-Id: Id1dbc552ed5a94a0b5fadddec0b5bea50c3a7597
Reviewed-on: https://chromium-review.googlesource.com/826662Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524007}
parent 26a26a55
......@@ -78,8 +78,8 @@ void CSSFontFaceSource::PruneOldestIfNeeded() {
if (font_cache_key_age.size() > kMaxCachedFontData) {
DCHECK_EQ(font_cache_key_age.size() - 1, kMaxCachedFontData);
FontCacheKey& key = font_cache_key_age.back();
font_cache_key_age.pop_back();
auto font_data_entry = font_data_table_.Take(key);
font_cache_key_age.pop_back();
DCHECK_EQ(font_cache_key_age.size(), kMaxCachedFontData);
if (font_data_entry && font_data_entry->GetCustomFontData())
font_data_entry->GetCustomFontData()->ClearFontFaceSource();
......
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