diff options
author | Werner Lemberg <wl@gnu.org> | 2018-08-23 17:53:54 +0200 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2018-08-23 17:53:54 +0200 |
commit | 77f0814a3162a945d6d6704f545827f883e451e5 (patch) | |
tree | 9a92acbc1609e929d8fcf4aca58b2be87436fd2c /src/base | |
parent | c90cc6443b2dc597aac64ae4a4bc45b1d5ca45d2 (diff) | |
download | freetype2-77f0814a3162a945d6d6704f545827f883e451e5.tar.gz |
Add macros for handling over-/underflowing `FT_Int64' values.
* include/freetype/internal/ftcalc.h (ADD_INT64, SUB_INT64,
MUL_INT64, DIV_INT64) [FT_LONG64]: New macros.
* src/base/ftcalc.c (ft_corner_orientation) [FT_LONG64]: Use
`SUB_INT64' and `MUL_INT64'.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10028
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/ftcalc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index f110c9ee2..7a421034c 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -983,9 +983,13 @@ FT_Pos out_x, FT_Pos out_y ) { + /* we silently ignore overflow errors since such large values */ + /* lead to even more (harmless) rendering errors later on */ + #ifdef FT_LONG64 - FT_Int64 delta = (FT_Int64)in_x * out_y - (FT_Int64)in_y * out_x; + FT_Int64 delta = SUB_INT64( MUL_INT64( in_x, out_y ), + MUL_INT64( in_y, out_x ) ); return ( delta > 0 ) - ( delta < 0 ); @@ -995,8 +999,6 @@ FT_Int result; - /* we silently ignore overflow errors, since such large values */ - /* lead to even more (harmless) rendering errors later on */ if ( ADD_LONG( FT_ABS( in_x ), FT_ABS( out_y ) ) <= 131071L && ADD_LONG( FT_ABS( in_y ), FT_ABS( out_x ) ) <= 131071L ) { |