Chromium Code Reviews

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

Issue 1263813004: Merge to XFA: Fix return check in CFX_FolderFontInfo::ScanFile() fread. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« 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 <limits> 7 #include <limits>
8 8
9 #include "../../../include/fxge/fx_ge.h" 9 #include "../../../include/fxge/fx_ge.h"
10 #include "../../../include/fxge/fx_freetype.h" 10 #include "../../../include/fxge/fx_freetype.h"
(...skipping 1446 matching lines...)
1457 } 1457 }
1458 1458
1459 if (GET_TT_LONG(buffer) == 0x74746366) { 1459 if (GET_TT_LONG(buffer) == 0x74746366) {
1460 FX_DWORD nFaces = GET_TT_LONG(buffer + 8); 1460 FX_DWORD nFaces = GET_TT_LONG(buffer + 8);
1461 if (nFaces > std::numeric_limits<FX_DWORD>::max() / 4) { 1461 if (nFaces > std::numeric_limits<FX_DWORD>::max() / 4) {
1462 FXSYS_fclose(pFile); 1462 FXSYS_fclose(pFile);
1463 return; 1463 return;
1464 } 1464 }
1465 FX_DWORD face_bytes = nFaces * 4; 1465 FX_DWORD face_bytes = nFaces * 4;
1466 uint8_t* offsets = FX_Alloc(uint8_t, face_bytes); 1466 uint8_t* offsets = FX_Alloc(uint8_t, face_bytes);
1467 readCnt = FXSYS_fread(offsets, face_bytes, 1, pFile); 1467 readCnt = FXSYS_fread(offsets, 1, face_bytes, pFile);
1468 if (readCnt != face_bytes) { 1468 if (readCnt != face_bytes) {
1469 FX_Free(offsets); 1469 FX_Free(offsets);
1470 FXSYS_fclose(pFile); 1470 FXSYS_fclose(pFile);
1471 return; 1471 return;
1472 } 1472 }
1473 for (FX_DWORD i = 0; i < nFaces; i ++) { 1473 for (FX_DWORD i = 0; i < nFaces; i ++) {
1474 uint8_t* p = offsets + i * 4; 1474 uint8_t* p = offsets + i * 4;
1475 ReportFace(path, pFile, filesize, GET_TT_LONG(p)); 1475 ReportFace(path, pFile, filesize, GET_TT_LONG(p));
1476 } 1476 }
1477 FX_Free(offsets); 1477 FX_Free(offsets);
(...skipping 138 matching lines...)
1616 return FALSE; 1616 return FALSE;
1617 } 1617 }
1618 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont; 1618 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont;
1619 name = pFont->m_FaceName; 1619 name = pFont->m_FaceName;
1620 return TRUE; 1620 return TRUE;
1621 } 1621 }
1622 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) 1622 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset)
1623 { 1623 {
1624 return FALSE; 1624 return FALSE;
1625 } 1625 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine