Fix a crash when parsing truetype fonts without any tables.
authorLei Zhang <thestig@chromium.org>
Mon, 9 Jun 2014 19:16:58 +0000 (12:16 -0700)
committerLei Zhang <thestig@chromium.org>
Mon, 9 Jun 2014 19:16:58 +0000 (12:16 -0700)
BUG=chromium:381011
R=bo_xu@foxitsoftware.com

Review URL: https://codereview.chromium.org/317203003

core/src/fxge/ge/fx_ge_fontmap.cpp

index 8c2751d..1b47f1f 100644 (file)
@@ -1428,6 +1428,9 @@ void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path, FXSYS_FILE* pFile, FX_
     }
     FX_DWORD nTables = GET_TT_SHORT(buffer + 4);
     CFX_ByteString tables = _FPDF_ReadStringFromFile(pFile, nTables * 16);
+    if (tables.IsEmpty()) {
+        return;
+    }
     CFX_ByteString names = _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x6e616d65);
     CFX_ByteString facename = _FPDF_GetNameFromTT(names, 1);
     CFX_ByteString style = _FPDF_GetNameFromTT(names, 2);