GNOME Bugzilla – Bug 565371
Crashes on some architectures because of wrong zero check on doubles
Last modified: 2009-02-19 23:34:06 UTC
The following test case makes librsvg crash on mips and sparc architectures (and basically all architectures where (int) NaN == INT_MAX): <?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns="http://www.w3.org/2000/svg"> <rect width="1" height="1" ry="1.7e-17" /> </svg>
Created attachment 125149 [details] [review] Correctly check the radius against division by zero This patch from Thomas Viehmann fixes the issue by replacing the (foo == 0.0) checks by appropriate ones.
Good catch. I'll cook up a similar patch that doesn't incur the fabs() penalty.
Is there really a penalty with fabs() ? GCC should inline it, leading to a minimal performance impact in this change.
I just know that Cairo and some other projects do things a bit differently for performance-related reasons. It's probably worth copying their lead, if only to be similar with a related project that shares some of the same goals and developers.