Index: core/fxcrt/include/fx_coordinates.h |
diff --git a/core/fxcrt/include/fx_coordinates.h b/core/fxcrt/include/fx_coordinates.h |
index eff2a7258a2bd5ca37315894b3d0f1072a5be482..ce97f6f6f3503f3b89240cd5370b4fb993e41014 100644 |
--- a/core/fxcrt/include/fx_coordinates.h |
+++ b/core/fxcrt/include/fx_coordinates.h |
@@ -150,6 +150,14 @@ struct FX_RECT { |
int Height() const { return bottom - top; } |
bool IsEmpty() const { return right <= left || bottom <= top; } |
+ bool Valid() const { |
+ pdfium::base::CheckedNumeric<int> w = right; |
+ pdfium::base::CheckedNumeric<int> h = bottom; |
+ w -= left; |
+ h -= top; |
+ return w.IsValid() && h.IsValid(); |
+ } |
+ |
void Normalize(); |
void Intersect(const FX_RECT& src); |