Chromium Code Reviews| Index: Source/platform/fonts/FontCustomPlatformData.cpp |
| diff --git a/Source/platform/fonts/FontCustomPlatformData.cpp b/Source/platform/fonts/FontCustomPlatformData.cpp |
| index 1cae8696dde0622b8f6c7993a978996dd3b131e5..39965332afb70e5765fbf3a387f9abb9c686d643 100644 |
| --- a/Source/platform/fonts/FontCustomPlatformData.cpp |
| +++ b/Source/platform/fonts/FontCustomPlatformData.cpp |
| @@ -85,14 +85,19 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(float size, bool bold, |
| return FontPlatformData(m_typeface.get(), "", size, bold && !m_typeface->isBold(), italic && !m_typeface->isItalic(), orientation); |
| } |
| -PassOwnPtr<FontCustomPlatformData> FontCustomPlatformData::create(SharedBuffer* buffer) |
| +PassOwnPtr<FontCustomPlatformData> FontCustomPlatformData::create(SharedBuffer* buffer, String& otsParseMessage) |
| { |
| ASSERT_ARG(buffer, buffer); |
| OpenTypeSanitizer sanitizer(buffer); |
| RefPtr<SharedBuffer> transcodeBuffer = sanitizer.sanitize(); |
| - if (!transcodeBuffer) |
| + |
| + if (!transcodeBuffer || sanitizer.isParsingError()) { |
| + if (sanitizer.isParsingError()) |
|
jungshik at Google
2015/05/12 20:22:48
I wonder if there's a case when transcodeBuffer==0
h.joshi
2015/05/14 04:52:15
Yes, two checks are not required. thank you.
Made
|
| + otsParseMessage = sanitizer.getErrorString(); |
| + |
| return nullptr; // validation failed. |
| + } |
| buffer = transcodeBuffer.get(); |
| SkMemoryStream* stream = new SkMemoryStream(buffer->getAsSkData().get()); |