1diff --git a/third_party/agg23/agg_clip_liang_barsky.h b/third_party/agg23/agg_clip_liang_barsky.h 2index db6ca97..5b1261f 100644 3--- a/third_party/agg23/agg_clip_liang_barsky.h 4+++ b/third_party/agg23/agg_clip_liang_barsky.h 5@@ -20,6 +20,7 @@ 6 #ifndef AGG_CLIP_LIANG_BARSKY_INCLUDED 7 #define AGG_CLIP_LIANG_BARSKY_INCLUDED 8 #include "agg_basics.h" 9+#include "third_party/base/numerics/safe_math.h" 10 namespace agg 11 { 12 template<class T> 13@@ -36,8 +37,18 @@ inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2, 14 T* x, T* y) 15 { 16 const float nearzero = 1e-30f; 17- float deltax = (float)(x2 - x1); 18- float deltay = (float)(y2 - y1); 19+ 20+ pdfium::base::CheckedNumeric<float> width = x2; 21+ width -= x1; 22+ if (!width.IsValid()) 23+ return 0; 24+ pdfium::base::CheckedNumeric<float> height = y2; 25+ height -= y1; 26+ if (!height.IsValid()) 27+ return 0; 28+ 29+ float deltax = width.ValueOrDefault(0); 30+ float deltay = height.ValueOrDefault(0); 31 unsigned np = 0; 32 if(deltax == 0) { 33 deltax = (x1 > clip_box.x1) ? -nearzero : nearzero; 34