From b1b8668ef12ae4e7fcb5fbf3f01fa623a319a092 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Mon, 8 Aug 2016 11:10:48 -0700 Subject: Check if image width or height are zero before proceeding. If the width of the CJBig2_Image is set to 0 then the stride_pixels will be zero and when we divide we'll get a floating point exception. If the width or height are zero then we can exit early without proceeding with the rest of the constructor. BUG=chromium:635008 Review-Url: https://codereview.chromium.org/2222843004 --- core/fxcodec/jbig2/JBig2_Image.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/fxcodec/jbig2') diff --git a/core/fxcodec/jbig2/JBig2_Image.cpp b/core/fxcodec/jbig2/JBig2_Image.cpp index b8cb21165b..2071221cd1 100644 --- a/core/fxcodec/jbig2/JBig2_Image.cpp +++ b/core/fxcodec/jbig2/JBig2_Image.cpp @@ -23,7 +23,7 @@ CJBig2_Image::CJBig2_Image(int32_t w, int32_t h) m_nHeight(0), m_nStride(0), m_bOwnsBuffer(true) { - if (w < 0 || h < 0 || w > kMaxImagePixels) + if (w <= 0 || h <= 0 || w > kMaxImagePixels) return; int32_t stride_pixels = (w + 31) & ~31; -- cgit v1.2.3