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

Unified Diff: core/fxcrt/include/fx_coordinates.h

Issue 2226023002: Fixup various overflow conditions (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Review cleanup Created 4 years, 4 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 | core/fxge/ge/fx_ge_device.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | core/fxge/ge/fx_ge_device.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698