Commit 2355c635 authored by Tom Sepez's avatar Tom Sepez Committed by Chromium LUCI CQ

Validate return code from FPDF_PageToDevice()

A DCHECK() here isn't sufficient to prevent the use of uninitialized
memory should this someday return false.

Bug: 1166091
Change-Id: I4cfd28653f2e6882f227299d68605be706b75b44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2628044Reviewed-by: default avatarK. Moon <kmoon@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843247}
parent 53913f6b
......@@ -1411,18 +1411,22 @@ gfx::Rect PDFiumPage::PageToScreen(const gfx::Point& page_point,
int new_left;
int new_top;
int new_right;
int new_bottom;
FPDF_BOOL ret = FPDF_PageToDevice(
if (!FPDF_PageToDevice(
page(), static_cast<int>(start_x), static_cast<int>(start_y),
static_cast<int>(ceil(size_x)), static_cast<int>(ceil(size_y)),
ToPDFiumRotation(orientation), left, top, &new_left, &new_top);
DCHECK(ret);
ret = FPDF_PageToDevice(
ToPDFiumRotation(orientation), left, top, &new_left, &new_top)) {
return gfx::Rect();
}
int new_right;
int new_bottom;
if (!FPDF_PageToDevice(
page(), static_cast<int>(start_x), static_cast<int>(start_y),
static_cast<int>(ceil(size_x)), static_cast<int>(ceil(size_y)),
ToPDFiumRotation(orientation), right, bottom, &new_right, &new_bottom);
DCHECK(ret);
ToPDFiumRotation(orientation), right, bottom, &new_right,
&new_bottom)) {
return gfx::Rect();
}
// If the PDF is rotated, the horizontal/vertical coordinates could be
// flipped. See
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment