aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkRemoteGlyphCache.cpp
diff options
context:
space:
mode:
authorGravatar Khushal <khushalsagar@chromium.org>2018-05-01 11:45:40 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-01 20:07:45 +0000
commit7e7369f7131d0b00f87cfb94e0fcbf91b02b4ee6 (patch)
treec9b26709775abb4aeced970e0b2a86ba1f3e5ec4 /src/core/SkRemoteGlyphCache.cpp
parent3fc6a185ca5de3fc25ec50726944afc525856863 (diff)
fonts: Dont memcpy with nullptr in SkRemoteGlyphCache
The behaviour is undefined and causes ASAN bots to complain. Bug: skia:7515 Change-Id: I454714ab9047a6fced5ab7bfdbc12214d728eadf Reviewed-on: https://skia-review.googlesource.com/125029 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Khusal Sagar <khushalsagar@chromium.org>
Diffstat (limited to 'src/core/SkRemoteGlyphCache.cpp')
-rw-r--r--src/core/SkRemoteGlyphCache.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/SkRemoteGlyphCache.cpp b/src/core/SkRemoteGlyphCache.cpp
index e45421aa05..06db562a9f 100644
--- a/src/core/SkRemoteGlyphCache.cpp
+++ b/src/core/SkRemoteGlyphCache.cpp
@@ -549,8 +549,8 @@ void SkStrikeServer::SkGlyphCacheState::writePendingGlyphs(Serializer* serialize
class SkStrikeClient::DiscardableStrikePinner : public SkStrikePinner {
public:
- DiscardableStrikePinner(SkDiscardableHandleId discardableHandleId,
- sk_sp<DiscardableHandleManager> manager)
+ DiscardableStrikePinner(
+ SkDiscardableHandleId discardableHandleId, sk_sp<DiscardableHandleManager> manager)
: fDiscardableHandleId(discardableHandleId), fManager(std::move(manager)) {}
~DiscardableStrikePinner() override = default;
@@ -635,17 +635,17 @@ bool SkStrikeClient::readStrikeData(const volatile void* memory, size_t memorySi
SkGlyph glyph;
if (!deserializer.read<SkGlyph>(&glyph)) READ_FAILURE
+ SkGlyph* allocatedGlyph = strike->getRawGlyphByID(glyph.getPackedID());
+ *allocatedGlyph = glyph;
+
ArraySlice<uint8_t> image;
auto imageSize = glyph.computeImageSize();
if (imageSize != 0) {
image = deserializer.readArray<uint8_t>(imageSize);
if (!image.data()) READ_FAILURE
+ allocatedGlyph->allocImage(strike->getAlloc());
+ memcpy(allocatedGlyph->fImage, image.data(), image.size());
}
-
- SkGlyph* allocatedGlyph = strike->getRawGlyphByID(glyph.getPackedID());
- *allocatedGlyph = glyph;
- allocatedGlyph->allocImage(strike->getAlloc());
- memcpy(allocatedGlyph->fImage, image.data(), image.size());
}
}