From 2050565fe116008ad6df7533900f5f76dd5b9730 Mon Sep 17 00:00:00 2001 From: Herbert Derby Date: Wed, 2 May 2018 08:02:27 -0400 Subject: Add padding back to make msan happy SkGlyph are stored directly in the hash table with uninitialized pad bytes. When the hash table is resized, the uninitialized pad bytes are moved causing msan to complain. Change-Id: I559ff1bd369d12be061cce7d3c826c2afdd3a03c Reviewed-on: https://skia-review.googlesource.com/125240 Commit-Queue: Herb Derby Commit-Queue: Mike Klein Auto-Submit: Herb Derby Reviewed-by: Mike Klein --- src/core/SkGlyph.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/core/SkGlyph.h b/src/core/SkGlyph.h index 87cd852bd8..959f9b78c8 100644 --- a/src/core/SkGlyph.h +++ b/src/core/SkGlyph.h @@ -131,6 +131,10 @@ struct SkPackedUnicharID : public SkPackedID { } }; +// Because SkGlyph is used directly in a hash table, it can be moved around using memcpy, and any +// uninitialized pad bytes will be considered uninitialized. Make sure all pad bytes have an +// initialized value. +SK_BEGIN_REQUIRE_DENSE class SkGlyph { // Support horizontal and vertical skipping strike-through / underlines. // The caller walks the linked list looking for a match. For a horizontal underline, @@ -160,6 +164,9 @@ public: uint8_t fMaskFormat; #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK int8_t fRsbDelta, fLsbDelta; // used by auto-kerning +#else + int8_t pad0{0}, pad1{0}; // It's simplest to add pads here. This will all change once + // we rip androids hand out of this data structure. #endif int8_t fForceBW; @@ -225,5 +232,6 @@ public: #endif SkPackedGlyphID fID; }; +SK_END_REQUIRE_DENSE #endif -- cgit v1.2.3