From dda2c0dc502b50d4de66b80305441bfb612ec6c1 Mon Sep 17 00:00:00 2001 From: tracy_jiang Date: Mon, 29 Aug 2016 13:42:56 -0700 Subject: Fix for #618267. Adding a method to determine if multiplication has overflow. BUG=618267 Review-Url: https://codereview.chromium.org/2284063002 --- core/fxcodec/codec/fx_codec_tiff.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core/fxcodec') diff --git a/core/fxcodec/codec/fx_codec_tiff.cpp b/core/fxcodec/codec/fx_codec_tiff.cpp index 09cfea4111..20fda6308f 100644 --- a/core/fxcodec/codec/fx_codec_tiff.cpp +++ b/core/fxcodec/codec/fx_codec_tiff.cpp @@ -79,6 +79,10 @@ int _TIFFmemcmp(const void* ptr1, const void* ptr2, tmsize_t size) { return FXSYS_memcmp(ptr1, ptr2, (size_t)size); } +int _TIFFIfMultiplicationOverflow(tmsize_t op1, tmsize_t op2) { + return op1 > std::numeric_limits::max() / op2; +} + TIFFErrorHandler _TIFFwarningHandler = nullptr; TIFFErrorHandler _TIFFerrorHandler = nullptr; -- cgit v1.2.3