From 1c469e9f755865b4020fafc00938d9f6cf5cb0df Mon Sep 17 00:00:00 2001 From: George Wright Date: Thu, 29 Aug 2013 12:24:26 -0400 Subject: [PATCH] Bug 903993 - null check the SkStream's getFileName() before attempting to use it, as the SkStream may not be an SkFILEStream r=snorp --- other-licenses/skia-npapi/ANPTypeface.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/other-licenses/skia-npapi/ANPTypeface.cpp b/other-licenses/skia-npapi/ANPTypeface.cpp index ed7ca5d47f4d..1a30f1244695 100644 --- a/other-licenses/skia-npapi/ANPTypeface.cpp +++ b/other-licenses/skia-npapi/ANPTypeface.cpp @@ -61,7 +61,12 @@ static ANPTypefaceStyle anp_getStyle(const ANPTypeface* tf) { static int32_t anp_getFontPath(const ANPTypeface* tf, char fileName[], int32_t length, int32_t* index) { SkStream* stream = tf->openStream(index); - strcpy(fileName, stream->getFileName()); + if (stream->getFileName()) { + strcpy(fileName, stream->getFileName()); + } else { + return 0; + } + return strlen(fileName); }