From 9364d22602a3db1e8f25b3e14310948857f2b54d Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 9 Jun 2014 12:16:58 -0700 Subject: Fix a crash when parsing truetype fonts without any tables. BUG=chromium:381011 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/317203003 --- core/src/fxge/ge/fx_ge_fontmap.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core/src/fxge') diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index 8c2751d84a..1b47f1ff14 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -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); -- cgit v1.2.3