[Poppler-bugs] [Bug 25578] Seen crahses in Fixed Point

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Dec 11 20:58:08 PST 2009


http://bugs.freedesktop.org/show_bug.cgi?id=25578





--- Comment #5 from Amit <amitcs06 at gmail.com>  2009-12-11 20:58:08 PST ---
OK thanks for the reply but splshSqrt is meant for fixedPoint also now its
using only sqrt function.

Thanks
Amit



On Sat, Dec 12, 2009 at 4:34 AM, <bugzilla-daemon at freedesktop.org> wrote:

> http://bugs.freedesktop.org/show_bug.cgi?id=25578
>
>
>
>
>
> --- Comment #4 from Albert Astals Cid <tsdgeos at terra.es>  2009-12-11
> 15:04:09 PST ---
> The patch is wrong for several reasons:
>  * FixedPoint val field is suposed to be a 16.16 value, you are turning it
> into
> a 64 bits value which removes the point of using FixedPoint arithmetics and
> you
> could as well use the regular double one
>  * You made div return 0 when diving by -1
>
> The actual problem is that the multiplication of 215.876 * 215.876 doesn't
> fit
> in a 16.16 field
>
> Of course the obvious fix is not using FixedPoint math for that
> multiplication
>
> diff --git a/splash/SplashFTFont.cc b/splash/SplashFTFont.cc
> index d4675f7..65371ba 100644
> --- a/splash/SplashFTFont.cc
> +++ b/splash/SplashFTFont.cc
> @@ -40,6 +40,8 @@
>  #include "SplashFTFontFile.h"
>  #include "SplashFTFont.h"
>
> +#include <cmath>
> +
>  //------------------------------------------------------------------------
>
>  static int glyphPathMoveTo(const FT_Vector *pt, void *path);
> @@ -67,13 +69,13 @@ SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA,
> SplashCoord *matA,
>     return;
>   }
>   face->size = sizeObj;
> -  size = splashSqrt(mat[2]*mat[2] + mat[3]*mat[3]);
> +  size = sqrt((double)mat[2]*(double)mat[2] +
> (double)mat[3]*(double)mat[3]);
>   if (FT_Set_Pixel_Sizes(face, 0, (int)size)) {
>     return;
>   }
>   // if the textMat values are too small, FreeType's fixed point
>   // arithmetic doesn't work so well
> -  textScale = splashSqrt(textMat[2]*textMat[2] + textMat[3]*textMat[3]) /
> size;
> +  textScale = sqrt((double)textMat[2]*(double)textMat[2] +
> (double)textMat[3]*(double)textMat[3]) / size;
>
>   div = face->bbox.xMax > 20000 ? 65536 : 1;
>
>
> --
> Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.
>


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Poppler-bugs mailing list