summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fxcodec/codec/fx_codec_tiff.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/fxcodec/codec/fx_codec_tiff.cpp b/core/fxcodec/codec/fx_codec_tiff.cpp
index c4c745587f..8046f1cc39 100644
--- a/core/fxcodec/codec/fx_codec_tiff.cpp
+++ b/core/fxcodec/codec/fx_codec_tiff.cpp
@@ -447,7 +447,11 @@ bool CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) {
uint16_t bps = 0;
TIFFGetField(m_tif_ctx, TIFFTAG_SAMPLESPERPIXEL, &spp);
TIFFGetField(m_tif_ctx, TIFFTAG_BITSPERSAMPLE, &bps);
- uint32_t bpp = bps * spp;
+ FX_SAFE_UINT32 safe_bpp = bps;
+ safe_bpp *= spp;
+ if (!safe_bpp.IsValid())
+ return false;
+ uint32_t bpp = safe_bpp.ValueOrDie();
if (bpp == 1)
return Decode1bppRGB(pDIBitmap, height, width, bps, spp);
if (bpp <= 8)