Issue metadata
Sign in to add a comment
|
webkit_unit_tests CSSFontFaceSourceTest.UnboundedGrowth fails with MSVC and DCHECKs enabled |
||||||||||||||||||||||||
Issue description
I think this is actually a true positive bug that could lead to crashes in production if the table is resized during pruning. We don't seem to have coverage of these tests in this configuration on the CQ, so nobody noticed.
This is the code in question:
scoped_refptr<SimpleFontData>& font_data =
font_data_table_.insert(key, nullptr).stored_value->value;
if (!font_data)
font_data = CreateFontData(font_description, font_selection_capabilities);
font_cache_key_age.PrependOrMoveToFirst(key);
PruneOldestIfNeeded(); // modifies font_data_table_
wtf::HashTable has a pretty neat DCHECK to protect against dangling iterators pointing into the table after modification. The result of the '.insert()' call is such an iterator. MSVC lifetime extends it to the entire scope, but clang does not.
If the iterator is lifetime extended, it gets destroyed *after* the PruneOldestIfNeeded() call, and it always asserts in DCHECK-enabled build modes. You can reproduce the issue with clang if you rewrite the code like so:
// tmp will live until after pruning and assert during cleanup
auto tmp = font_data_table_.insert(key, nullptr);
scoped_refptr<SimpleFontData>& font_data = tmp.stored_value->value;
|font_data| is a reference into the table, so if the table is rehashed, it will dangle. We should copy the scoped_refptr earlier and let NRVO elide the copy that would normally take place in the return. I'll put together a CL.
,
Jan 5 2018
Fix: https://chromium-review.googlesource.com/852531 Dirk, oh, I thought win-msvc ran tests, but win-dbg did not. I see I was mistaken. Just doing compilation isn't really enough to make sure that MSVC-built chrome really works. People are hitting use-after-move all the time, see the discussion about it on chromium-dev. I would at least want to run the tests in release mode, maybe just on chromium.win if the CQ doesn't have the capacity to run tests there.
,
Jan 5 2018
Yup, that seems like a good thing to do.
,
Jan 8 2018
,
Jan 18 2018
,
Feb 15 2018
|
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by dpranke@chromium.org
, Jan 5 2018