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

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

Issue 1262453006: Fix return check in CFX_FolderFontInfo::ScanFile() fread. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 4 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 <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 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 } 1360 }
1361 1361
1362 if (GET_TT_LONG(buffer) == 0x74746366) { 1362 if (GET_TT_LONG(buffer) == 0x74746366) {
1363 FX_DWORD nFaces = GET_TT_LONG(buffer + 8); 1363 FX_DWORD nFaces = GET_TT_LONG(buffer + 8);
1364 if (nFaces > std::numeric_limits<FX_DWORD>::max() / 4) { 1364 if (nFaces > std::numeric_limits<FX_DWORD>::max() / 4) {
1365 FXSYS_fclose(pFile); 1365 FXSYS_fclose(pFile);
1366 return; 1366 return;
1367 } 1367 }
1368 FX_DWORD face_bytes = nFaces * 4; 1368 FX_DWORD face_bytes = nFaces * 4;
1369 uint8_t* offsets = FX_Alloc(uint8_t, face_bytes); 1369 uint8_t* offsets = FX_Alloc(uint8_t, face_bytes);
1370 readCnt = FXSYS_fread(offsets, face_bytes, 1, pFile); 1370 readCnt = FXSYS_fread(offsets, 1, face_bytes, pFile);
1371 if (readCnt != face_bytes) { 1371 if (readCnt != face_bytes) {
1372 FX_Free(offsets); 1372 FX_Free(offsets);
1373 FXSYS_fclose(pFile); 1373 FXSYS_fclose(pFile);
1374 return; 1374 return;
1375 } 1375 }
1376 for (FX_DWORD i = 0; i < nFaces; i ++) { 1376 for (FX_DWORD i = 0; i < nFaces; i ++) {
1377 uint8_t* p = offsets + i * 4; 1377 uint8_t* p = offsets + i * 4;
1378 ReportFace(path, pFile, filesize, GET_TT_LONG(p)); 1378 ReportFace(path, pFile, filesize, GET_TT_LONG(p));
1379 } 1379 }
1380 FX_Free(offsets); 1380 FX_Free(offsets);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 return FALSE; 1512 return FALSE;
1513 } 1513 }
1514 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont; 1514 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont;
1515 name = pFont->m_FaceName; 1515 name = pFont->m_FaceName;
1516 return TRUE; 1516 return TRUE;
1517 } 1517 }
1518 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) 1518 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset)
1519 { 1519 {
1520 return FALSE; 1520 return FALSE;
1521 } 1521 }
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