aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkGlyph.h
diff options
context:
space:
mode:
authorGravatar Herbert Derby <herb@google.com>2018-05-02 08:02:27 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-02 12:30:47 +0000
commit2050565fe116008ad6df7533900f5f76dd5b9730 (patch)
tree285d68986b5fbd358180532c8dc3f5d5f68b082a /src/core/SkGlyph.h
parenteaded9d09c310f96715d1691dbd1c56d73bb2043 (diff)
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 <herb@google.com> Commit-Queue: Mike Klein <mtklein@google.com> Auto-Submit: Herb Derby <herb@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
Diffstat (limited to 'src/core/SkGlyph.h')
-rw-r--r--src/core/SkGlyph.h8
1 files changed, 8 insertions, 0 deletions
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