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

Unified Diff: core/fpdfapi/fpdf_font/cpdf_cidfont.cpp

Issue 2293633002: Guard against overflow when calculating font weight. (Closed)
Patch Set: Review feedback Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_font/cpdf_simplefont.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
index 491bd6d0c7895c70e4a67efb93cc1f8681139022..2bd886754e63cf92843599748429439060d08a69 100644
--- a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
@@ -18,6 +18,7 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h"
#include "core/fpdfapi/include/cpdf_modulemgr.h"
+#include "third_party/base/numerics/safe_math.h"
namespace {
@@ -768,7 +769,10 @@ FX_BOOL CPDF_CIDFont::IsUnicodeCompatible() const {
}
void CPDF_CIDFont::LoadSubstFont() {
- m_Font.LoadSubst(m_BaseFont, !m_bType1, m_Flags, m_StemV * 5, m_ItalicAngle,
+ pdfium::base::CheckedNumeric<int> safeStemV(m_StemV);
+ safeStemV *= 5;
+ m_Font.LoadSubst(m_BaseFont, !m_bType1, m_Flags,
+ safeStemV.ValueOrDefault(FXFONT_FW_NORMAL), m_ItalicAngle,
g_CharsetCPs[m_Charset], IsVertWriting());
}
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_font/cpdf_simplefont.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698