diff options
author | tsepez <tsepez@chromium.org> | 2017-01-23 14:36:20 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2017-01-23 14:36:20 -0800 |
commit | 4022f87eb8716155291543efaaf289e51d7cbf43 (patch) | |
tree | 28e2a3b99367932ee84a92b1f6c913245e62afb1 /core/fxge/ge | |
parent | b76f49b36baffea2b2ecb90d67c7b6bb734e7bb9 (diff) | |
download | pdfium-4022f87eb8716155291543efaaf289e51d7cbf43.tar.xz |
Update safe numerics package to get bitwise ops
Fix callers conventions to avoid ambiguity.
Fix bad bounds check unmasked by change.
Directly include headers no longer pulled in by numerics itself.
Review-Url: https://codereview.chromium.org/2640143003
Diffstat (limited to 'core/fxge/ge')
-rw-r--r-- | core/fxge/ge/cfx_renderdevice.cpp | 6 | ||||
-rw-r--r-- | core/fxge/ge/fx_ge_text.cpp | 12 |
2 files changed, 12 insertions, 6 deletions
diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp index 9c67a7d1e7..0e6a4e74af 100644 --- a/core/fxge/ge/cfx_renderdevice.cpp +++ b/core/fxge/ge/cfx_renderdevice.cpp @@ -1022,13 +1022,15 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, bool bBGRStripe = !!(text_flags & FXTEXT_BGR_STRIPE); ncols /= 3; int x_subpixel = (int)(glyph.m_fOriginX * 3) % 3; - int start_col = std::max(left.ValueOrDie(), 0); + int start_col = + pdfium::base::ValueOrDieForType<int>(pdfium::base::CheckMax(left, 0)); pdfium::base::CheckedNumeric<int> end_col_safe = left; end_col_safe += ncols; if (!end_col_safe.IsValid()) return false; - int end_col = std::min(end_col_safe.ValueOrDie(), dest_width); + int end_col = + std::min(static_cast<int>(end_col_safe.ValueOrDie<int>()), dest_width); if (start_col >= end_col) continue; diff --git a/core/fxge/ge/fx_ge_text.cpp b/core/fxge/ge/fx_ge_text.cpp index ca88879d10..cc7ef7c6d7 100644 --- a/core/fxge/ge/fx_ge_text.cpp +++ b/core/fxge/ge/fx_ge_text.cpp @@ -79,10 +79,14 @@ FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs, continue; if (bStarted) { - rect.left = std::min(rect.left, char_left.ValueOrDie()); - rect.right = std::max(rect.right, char_right.ValueOrDie()); - rect.top = std::min(rect.top, char_top.ValueOrDie()); - rect.bottom = std::max(rect.bottom, char_bottom.ValueOrDie()); + rect.left = pdfium::base::ValueOrDieForType<int32_t>( + pdfium::base::CheckMin(rect.left, char_left)); + rect.right = pdfium::base::ValueOrDieForType<int32_t>( + pdfium::base::CheckMax(rect.right, char_right)); + rect.top = pdfium::base::ValueOrDieForType<int32_t>( + pdfium::base::CheckMin(rect.top, char_top)); + rect.bottom = pdfium::base::ValueOrDieForType<int32_t>( + pdfium::base::CheckMax(rect.bottom, char_bottom)); continue; } |