From 4e597c8fd5d604273266ea19a1074a2c870ba224 Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 7 Nov 2016 15:16:01 -0800 Subject: Force compiler to deduce src type for checked_cast. Otherwise, we might be silently doing an unsafe cast before applying the check if the actual argument doesn't match the exact src type. Review-Url: https://codereview.chromium.org/2484953003 --- fpdfsdk/fpdfview.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 9142dc78c9..334c14cd45 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -192,8 +192,7 @@ bool CPDF_CustomAccess::ReadBlock(void* buffer, if (offset < 0) return false; - FX_SAFE_FILESIZE newPos = - pdfium::base::checked_cast(size); + FX_SAFE_FILESIZE newPos = pdfium::base::checked_cast(size); newPos += offset; if (!newPos.IsValid() || newPos.ValueOrDie() > static_cast(m_FileAccess.m_FileLen)) { @@ -388,8 +387,7 @@ class CMemFile final : public IFX_SeekableReadStream { if (offset < 0) { return false; } - FX_SAFE_FILESIZE newPos = - pdfium::base::checked_cast(size); + FX_SAFE_FILESIZE newPos = pdfium::base::checked_cast(size); newPos += offset; if (!newPos.IsValid() || newPos.ValueOrDie() > m_size) { return false; -- cgit v1.2.3