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
diff --git a/core/fxcodec/jbig2/JBig2_Image.cpp b/core/fxcodec/jbig2/JBig2_Image.cpp index b8cb211..2071221 100644 --- a/core/fxcodec/jbig2/JBig2_Image.cpp +++ b/core/fxcodec/jbig2/JBig2_Image.cpp
@@ -23,7 +23,7 @@ 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;