Correctly handle integer overflows in DrawNormalText().
In CFX_RenderDevice::DrawNormalText(), skip bad glyphs and continue,
instead of returning false. Returning false means DrawNormalText() did
not draw, so the caller may need to use some fallback drawing method.
Change-Id: I7def38e28d866f5c8f0f4131a95b191e9e09ca3e
Reviewed-on: https://pdfium-review.googlesource.com/c/50111
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 262731a..ed7949a 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -1014,7 +1014,7 @@
Optional<CFX_Point> point = glyph.GetOrigin({pixel_left, pixel_top});
if (!point.has_value())
- return false;
+ continue;
const RetainPtr<CFX_DIBitmap>& pGlyph = glyph.m_pGlyph->GetBitmap();
int ncols = pGlyph->GetWidth();
@@ -1034,7 +1034,7 @@
FX_SAFE_INT32 end_col_safe = point->x;
end_col_safe += ncols;
if (!end_col_safe.IsValid())
- return false;
+ continue;
int end_col = std::min<int>(end_col_safe.ValueOrDie(), dest_width);
if (start_col >= end_col)