forked from minhngoc25a/freetype2
* src/base/ftcalc.c (FT_MulFix) [FT_LONG64]: Improve.
This commit is contained in:
parent
7962a15d64
commit
3ea0d2c65a
|
@ -1,3 +1,7 @@
|
|||
2015-09-14 Alexei Podtelezhnikov <apodtele@gmail.com>
|
||||
|
||||
* src/base/ftcalc.c (FT_MulFix) [FT_LONG64]: Improve.
|
||||
|
||||
2015-09-14 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[type1] Fix another potential buffer overflow (#45955).
|
||||
|
|
|
@ -237,22 +237,10 @@
|
|||
|
||||
#else
|
||||
|
||||
FT_Int s = 1;
|
||||
FT_UInt64 a, b, c;
|
||||
FT_Long c_;
|
||||
FT_Int64 ab = (FT_Int64)a_ * (FT_Int64)b_;
|
||||
|
||||
|
||||
FT_MOVE_SIGN( a_, s );
|
||||
FT_MOVE_SIGN( b_, s );
|
||||
|
||||
a = (FT_UInt64)a_;
|
||||
b = (FT_UInt64)b_;
|
||||
|
||||
c = ( a * b + 0x8000UL ) >> 16;
|
||||
|
||||
c_ = (FT_Long)c;
|
||||
|
||||
return s < 0 ? -c_ : c_;
|
||||
/* this requires arithmetic right shift of signed numbers */
|
||||
return (FT_Long)( ( ab + 0x8000L - ( ab < 0 ) ) >> 16 );
|
||||
|
||||
#endif /* FT_MULFIX_ASSEMBLER */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue