 Chromium Code Reviews
 Chromium Code Reviews Issue 433293002:
  When normalize coordinate, return instead of assert() when divide by 0  (Closed) 
  Base URL: https://pdfium.googlesource.com/pdfium.git@master
    
  
    Issue 433293002:
  When normalize coordinate, return instead of assert() when divide by 0  (Closed) 
  Base URL: https://pdfium.googlesource.com/pdfium.git@master| Index: core/include/fxcrt/fx_coordinates.h | 
| diff --git a/core/include/fxcrt/fx_coordinates.h b/core/include/fxcrt/fx_coordinates.h | 
| index 9a63e2a4ad5946afd582975dc2a84c1e465169f8..6ec3b5e1ebb2fd69fb1ecf05f5508f69fe4a1c79 100644 | 
| --- a/core/include/fxcrt/fx_coordinates.h | 
| +++ b/core/include/fxcrt/fx_coordinates.h | 
| @@ -156,7 +156,9 @@ public: | 
| void Normalize() | 
| { | 
| FX_FLOAT fLen = FXSYS_sqrt(FXT_PSV::x * FXT_PSV::x + FXT_PSV::y * FXT_PSV::y); | 
| - FXSYS_assert(fLen >= 0.0001f); | 
| + if (fLen < 0.0001f) { | 
| 
Tom Sepez
2014/08/04 17:09:38
Isn't .0001f a kinda large value for near-zero? I'
 
Bo Xu
2014/08/04 18:48:09
For some fuzz test, the x, and y are set to be rea
 | 
| + return; | 
| + } | 
| FXT_PSV::x = ((baseType)FXT_PSV::x) / fLen; | 
| FXT_PSV::y = ((baseType)FXT_PSV::y) / fLen; | 
| } |