summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/fpdf_font/fpdf_font.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/core/fpdfapi/fpdf_font/fpdf_font.cpp b/core/fpdfapi/fpdf_font/fpdf_font.cpp
index cff5223a00..825cd61b52 100644
--- a/core/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -18,6 +18,7 @@
#include "core/fpdfapi/fpdf_parser/cpdf_simple_parser.h"
#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h"
#include "core/fxcrt/fx_ext.h"
+#include "core/fxcrt/fx_safe_types.h"
#include "core/fxge/fx_freetype.h"
#include "third_party/base/numerics/safe_conversions.h"
#include "third_party/base/stl_util.h"
@@ -224,7 +225,10 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
if (len == 1) {
m_Map[srccode] = destcode.GetAt(0);
} else {
- m_Map[srccode] = m_MultiCharBuf.GetLength() * 0x10000 + 0xffff;
+ FX_SAFE_UINT32 uni = m_MultiCharBuf.GetLength();
+ uni *= 0x10000;
+ uni += 0xffff;
+ m_Map[srccode] = uni.ValueOrDie();
m_MultiCharBuf.AppendChar(destcode.GetLength());
m_MultiCharBuf << destcode;
}
@@ -255,7 +259,10 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
if (len == 1) {
m_Map[code] = destcode.GetAt(0);
} else {
- m_Map[code] = m_MultiCharBuf.GetLength() * 0x10000 + 0xffff;
+ FX_SAFE_UINT32 uni = m_MultiCharBuf.GetLength();
+ uni *= 0x10000;
+ uni += 0xffff;
+ m_Map[code] = uni.ValueOrDie();
m_MultiCharBuf.AppendChar(destcode.GetLength());
m_MultiCharBuf << destcode;
}
@@ -278,7 +285,10 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
} else {
retcode = StringDataAdd(destcode);
}
- m_Map[code] = m_MultiCharBuf.GetLength() * 0x10000 + 0xffff;
+ FX_SAFE_UINT32 uni = m_MultiCharBuf.GetLength();
+ uni *= 0x10000;
+ uni += 0xffff;
+ m_Map[code] = uni.ValueOrDie();
m_MultiCharBuf.AppendChar(retcode.GetLength());
m_MultiCharBuf << retcode;
destcode = retcode;