summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-11-02 13:29:26 -0800
committerLei Zhang <thestig@chromium.org>2015-11-02 13:29:26 -0800
commit99818557c8ed64d00fcc23a1e87e1ebf41ed5e85 (patch)
tree801e4edff6023d8b77d31fcd9b759945fc705ff9
parentafca65ac019d2ad4cb8ac8f585809cc1a519ac2b (diff)
downloadpdfium-99818557c8ed64d00fcc23a1e87e1ebf41ed5e85.tar.xz
Check fread() return values in CFX_FolderFontInfo::GetFontData().
Check fseek() return values too. BUG=549998 R=thakis@chromium.org Review URL: https://codereview.chromium.org/1419793003 .
-rw-r--r--core/src/fxge/ge/fx_ge_fontmap.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index af0a9efdaa..4f627ac96b 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) {
- 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);