Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(986)

Unified Diff: core/src/fxge/win32/fx_win32_device.cpp

Issue 432543002: Fix integer overflow when stretching bitmap for printing (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Use FX_INT64 Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxge/win32/fx_win32_device.cpp
diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp
index 154bbc407c873b132e1f52064ce55d463131978c..5e76898db138656b796a4ddc809b9a19c6ea42b3 100644
--- a/core/src/fxge/win32/fx_win32_device.cpp
+++ b/core/src/fxge/win32/fx_win32_device.cpp
@@ -523,7 +523,7 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(const CFX_DIBitmap* pBitmap1, int de
return FALSE;
}
CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
- if (abs(dest_width) * abs(dest_height) < pBitmap1->GetWidth() * pBitmap1->GetHeight() * 4 ||
+ if ((FX_INT64)abs(dest_width) * abs(dest_height) < (FX_INT64)pBitmap1->GetWidth() * pBitmap1->GetHeight() * 4 ||
(flags & FXDIB_INTERPOL) || (flags & FXDIB_BICUBIC_INTERPOL)) {
SetStretchBltMode(m_hDC, HALFTONE);
} else {
@@ -531,7 +531,7 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(const CFX_DIBitmap* pBitmap1, int de
}
CFX_DIBitmap* pToStrechBitmap = pBitmap;
bool del = false;
- if (m_DeviceClass == FXDC_PRINTER && (pBitmap->GetWidth() * pBitmap->GetHeight() > abs(dest_width) * abs(dest_height))) {
+ if (m_DeviceClass == FXDC_PRINTER && ((FX_INT64)pBitmap->GetWidth() * pBitmap->GetHeight() > (FX_INT64)abs(dest_width) * abs(dest_height))) {
pToStrechBitmap = pBitmap->StretchTo(dest_width, dest_height);
del = true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698