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

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

Issue 433293002: When normalize coordinate, return instead of assert() when divide by 0 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698