Assert text passed to canvas is initialized.

A new fuzzer appears to be complaining about using uninitialized glyph
ids. These uninitilized glyph ids appear to be comming from far up the
stack, but they don't actually get used until much later. If Skia is
passed uninitialized memory in a draw call it will of course eventually
need to use it and be blamed when it does. This change will make it
obvious if the issue is up stack from Skia.

BUG=chromium:750070,chromium:750071,chromium:750072

Change-Id: Ic6ca2f6af3620ad4a31cb017570f42550360891a
Reviewed-on: https://skia-review.googlesource.com/29421
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 91a534c..4a777b2 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -24,6 +24,7 @@
 #include "SkMakeUnique.h"
 #include "SkMatrixUtils.h"
 #include "SkMetaData.h"
+#include "SkMSAN.h"
 #include "SkNoDrawCanvas.h"
 #include "SkNx.h"
 #include "SkPaintPriv.h"
@@ -2567,6 +2568,7 @@
                         const SkPaint& paint) {
     TRACE_EVENT0("skia", TRACE_FUNC);
     if (byteLength) {
+        sk_msan_assert_initialized(text, SkTAddOffset<const void>(text, byteLength));
         this->onDrawText(text, byteLength, x, y, paint);
     }
 }
@@ -2574,6 +2576,7 @@
                            const SkPaint& paint) {
     TRACE_EVENT0("skia", TRACE_FUNC);
     if (byteLength) {
+        sk_msan_assert_initialized(text, SkTAddOffset<const void>(text, byteLength));
         this->onDrawPosText(text, byteLength, pos, paint);
     }
 }
@@ -2581,6 +2584,7 @@
                             SkScalar constY, const SkPaint& paint) {
     TRACE_EVENT0("skia", TRACE_FUNC);
     if (byteLength) {
+        sk_msan_assert_initialized(text, SkTAddOffset<const void>(text, byteLength));
         this->onDrawPosTextH(text, byteLength, xpos, constY, paint);
     }
 }
@@ -2588,6 +2592,7 @@
                               const SkMatrix* matrix, const SkPaint& paint) {
     TRACE_EVENT0("skia", TRACE_FUNC);
     if (byteLength) {
+        sk_msan_assert_initialized(text, SkTAddOffset<const void>(text, byteLength));
         this->onDrawTextOnPath(text, byteLength, path, matrix, paint);
     }
 }
@@ -2595,6 +2600,7 @@
                                const SkRect* cullRect, const SkPaint& paint) {
     TRACE_EVENT0("skia", TRACE_FUNC);
     if (byteLength) {
+        sk_msan_assert_initialized(text, SkTAddOffset<const void>(text, byteLength));
         this->onDrawTextRSXform(text, byteLength, xform, cullRect, paint);
     }
 }