[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Devel] Major bug found: solution included!
From: |
Martin Muskens |
Subject: |
[Devel] Major bug found: solution included! |
Date: |
Thu, 16 Aug 2001 12:28:25 +0200 |
Hello
I found a bug in ftcalc.c which causes in many ( if not all ) TrueType fonts
characters to display incorrect when in ftoption.h
TT_CONFIG_OPTION_BYTECODE_INTERPRETER is defined.
the original code was:
FT_EXPORT_DEF( FT_Long )
FT_MulDiv( FT_Long a,
FT_Long b,
FT_Long c )
{
long s;
if ( a == 0 || b == c )
return a;
s = a; a = ABS( a );
s ^= b; b = ABS( b );
s ^= c; c = ABS( c );
if ( a <= 46340L && b <= 46340L && c <= 176095L && c > 0 )
{
a = ( a * b + ( c >> 1 ) ) / c;
}
else if ( c > 0 )
{
FT_Int64 temp, temp2;
ft_multo64( a, b, &temp );
temp2.hi = 0;
temp2.lo = (FT_UInt32)(c >> 1);
FT_Add64( &temp, &temp2, &temp );
a = ft_div64by32( temp.hi, temp.lo, b );
}
else
a = 0x7FFFFFFFL;
return ( s < 0 ? -a : a );
}
the change is in the line:
a = ft_div64by32( temp.hi, temp.lo, b );
the parameter b has to be changed into c, so the correct statement is:
a = ft_div64by32( temp.hi, temp.lo, C );
This bug got in somewhere around version 38.
I am looking into another bug which also resides in ftcalc.c ( when I use an
old one the bug is gone )
When I find it, I will report it!
M.Muskens
Aurelon
- [Devel] Major bug found: solution included!,
Martin Muskens <=