diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2018-03-12 17:18:14 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-03-12 17:18:14 +0000 |
commit | 83a01491dbd91e31c9d9417b8b975259a0fb3aec (patch) | |
tree | 2c8a8eb719f5c3810c1a0ca4c5feae78215bd501 /core/fxge/dib/cfx_dibitmap.cpp | |
parent | 64c664387d71ed01d18ab2b23327bbdd9757bd46 (diff) | |
download | pdfium-83a01491dbd91e31c9d9417b8b975259a0fb3aec.tar.xz |
Fix crash when creating a CFX_DIBitmap with FXDIB_Invalid.
Bug: chromium:820885
Change-Id: I3886c636b91a8499924d95ad47f4c832db9f9754
Reviewed-on: https://pdfium-review.googlesource.com/28491
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fxge/dib/cfx_dibitmap.cpp')
-rw-r--r-- | core/fxge/dib/cfx_dibitmap.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp index 857ca9a3ce..a9764e7550 100644 --- a/core/fxge/dib/cfx_dibitmap.cpp +++ b/core/fxge/dib/cfx_dibitmap.cpp @@ -819,7 +819,10 @@ bool CFX_DIBitmap::CalculatePitchAndSize(int height, if (width <= 0 || height <= 0) return false; - if ((INT_MAX - 31) / width < (format & 0xFF)) + if (!(format & 0xff)) + return false; + + if ((INT_MAX - 31) / width < (format & 0xff)) return false; if (!*pitch) |