Closed Raziel-23 closed 9 years ago
Thank you for the report and the patch. Has it been sent to the upstream yet?
@bohoomil: To be honest I don't know where this patch can also be sent.
@bohoomil I checked and this patch also fixes #81
Thank you very much for checking this out.
It seems like a good idea to submit the patch to the upstream at freedesktop.org and inform them that the patch solves these two issues. I believe this is a pretty crucial improvement that should be available in the stock fontconfig.
@bohoomil I checked the release version (fontconfig 2.11.1), but there aren't such conversions. In the development version (git version) there are, but I installed the fontconfig git version and I'm unable to reproduce such crashes. I don't know well the source code of fontconfig, maybe they do something differently, but it appears that those crashes only shows up with the infinality version and are not related to the stock version. Nevertheless I'm glad that I helped and I want to thank you for the great job you are doing with this infinality version.
An overflow may occur when casting double (8 bytes) to int (4 bytes), because double has a much wider range then int. It happens when I run dslstats program:
As you can see just after running dslstats it receives SIGFPE signal which leads to its crash. The c.u.d.end value is 1.7976931348623157e+308 which is almost the maximum value of double type. This patch assure that when casting from double to int the result will be between valid range <INT_MAX, INT_MIN>. Even though this overflow is rare (for me it only occurs when I run dslstats), this patch may fix other similar crashes.