Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: core/src/fxge/ge/fx_ge_fontmap.cpp

Issue 317203003: Fix a crash when parsing truetype fonts without any tables. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../../include/fxge/fx_ge.h" 7 #include "../../../include/fxge/fx_ge.h"
8 #include "../../../include/fxge/fx_freetype.h" 8 #include "../../../include/fxge/fx_freetype.h"
9 #include "text_int.h" 9 #include "text_int.h"
10 #define GET_TT_SHORT(w) (FX_WORD)(((w)[0] << 8) | (w)[1]) 10 #define GET_TT_SHORT(w) (FX_WORD)(((w)[0] << 8) | (w)[1])
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 } 1421 }
1422 void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path, FXSYS_FILE* pFile, FX_ DWORD filesize, FX_DWORD offset) 1422 void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path, FXSYS_FILE* pFile, FX_ DWORD filesize, FX_DWORD offset)
1423 { 1423 {
1424 FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET); 1424 FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET);
1425 char buffer[16]; 1425 char buffer[16];
1426 if (!FXSYS_fread(buffer, 12, 1, pFile)) { 1426 if (!FXSYS_fread(buffer, 12, 1, pFile)) {
1427 return; 1427 return;
1428 } 1428 }
1429 FX_DWORD nTables = GET_TT_SHORT(buffer + 4); 1429 FX_DWORD nTables = GET_TT_SHORT(buffer + 4);
1430 CFX_ByteString tables = _FPDF_ReadStringFromFile(pFile, nTables * 16); 1430 CFX_ByteString tables = _FPDF_ReadStringFromFile(pFile, nTables * 16);
1431 if (tables.IsEmpty()) {
1432 return;
1433 }
1431 CFX_ByteString names = _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x6e616 d65); 1434 CFX_ByteString names = _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x6e616 d65);
1432 CFX_ByteString facename = _FPDF_GetNameFromTT(names, 1); 1435 CFX_ByteString facename = _FPDF_GetNameFromTT(names, 1);
1433 CFX_ByteString style = _FPDF_GetNameFromTT(names, 2); 1436 CFX_ByteString style = _FPDF_GetNameFromTT(names, 2);
1434 if (style != "Regular") { 1437 if (style != "Regular") {
1435 facename += " " + style; 1438 facename += " " + style;
1436 } 1439 }
1437 FX_LPVOID p; 1440 FX_LPVOID p;
1438 if (m_FontList.Lookup(facename, p)) { 1441 if (m_FontList.Lookup(facename, p)) {
1439 return; 1442 return;
1440 } 1443 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 } 1552 }
1550 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont; 1553 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont;
1551 name = pFont->m_FaceName; 1554 name = pFont->m_FaceName;
1552 return TRUE; 1555 return TRUE;
1553 } 1556 }
1554 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) 1557 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset)
1555 { 1558 {
1556 return FALSE; 1559 return FALSE;
1557 } 1560 }
1558 #endif 1561 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698