summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_font
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/fpdf_font')
-rw-r--r--core/fpdfapi/fpdf_font/fpdf_font.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/fpdfapi/fpdf_font/fpdf_font.cpp b/core/fpdfapi/fpdf_font/fpdf_font.cpp
index fefe936543..a14c43d4fa 100644
--- a/core/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -19,13 +19,15 @@
#include "core/fpdfapi/include/cpdf_modulemgr.h"
#include "core/fxcrt/include/fx_ext.h"
#include "core/fxge/include/fx_freetype.h"
+#include "third_party/base/numerics/safe_conversions.h"
#include "third_party/base/stl_util.h"
int TT2PDF(int m, FXFT_Face face) {
int upm = FXFT_Get_Face_UnitsPerEM(face);
if (upm == 0)
return m;
- return (m * 1000 + upm / 2) / upm;
+ return pdfium::base::checked_cast<int>(
+ (static_cast<double>(m) * 1000 + upm / 2) / upm);
}
bool FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id) {