Speculative fix for crash in CGdiDeviceDriver::GDI_StretchDIBits()
Check for failed stretched operation and return false instead of
crashing.
Bug: chromium:1466498
Change-Id: Ieb37774a7a2b3df75c78437e4b211c4e4503d7f3
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/110050
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/win32/cgdi_device_driver.cpp b/core/fxge/win32/cgdi_device_driver.cpp
index b794a49..6ae582e 100644
--- a/core/fxge/win32/cgdi_device_driver.cpp
+++ b/core/fxge/win32/cgdi_device_driver.cpp
@@ -444,6 +444,9 @@
(int64_t)abs(dest_width) * abs(dest_height))) {
stretch_source = source->StretchTo(dest_width, dest_height,
FXDIB_ResampleOptions(), nullptr);
+ if (!stretch_source) {
+ return false;
+ }
info = GetBitmapInfo(stretch_source);
}
::StretchDIBits(m_hDC, dest_left, dest_top, dest_width, dest_height, 0, 0,