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

Unified Diff: core/src/fxge/ge/fx_ge_fontmap.cpp

Issue 1419793003: Check fread() return values in CFX_FolderFontInfo::GetFontData(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxge/ge/fx_ge_fontmap.cpp
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index af0a9efdaadc71e0c0cfa3127adcc9eaec471cf9..4f627ac96b471be15b635638927181540b770d20 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -1510,8 +1510,10 @@ FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont,
}
}
if (datasize && size >= datasize && pFile) {
Nico 2015/11/02 19:55:43 From how I understood the code, this check was sup
Lei Zhang 2015/11/02 19:59:09 Just because the buffer is big enough, and |pFile|
- FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET);
- FXSYS_fread(buffer, datasize, 1, pFile);
+ if (FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET) < 0 ||
+ FXSYS_fread(buffer, datasize, 1, pFile) != 1) {
+ datasize = 0;
+ }
}
if (pFile) {
FXSYS_fclose(pFile);
« 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