diff options
author | Werner Lemberg <wl@gnu.org> | 2022-09-30 23:25:02 +0200 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2022-09-30 23:25:02 +0200 |
commit | de8f14a8e41bf5e01714539cbcd3de16d546ce6c (patch) | |
tree | 0908b6ad3ad5e361580a0c0ec6a45c78839de268 | |
parent | 2adb810c3d40e3e738c878d89af62bd344879e79 (diff) | |
download | freetype2-de8f14a8e41bf5e01714539cbcd3de16d546ce6c.tar.gz |
* src/psaux/pshints.c (cf2_hintmap_insertHint): Fix midpoint computation.
Replace '(start + end) / 2' with 'start + (end - start) / 2' to avoid
overflow.
Fixes #1180.
-rw-r--r-- | src/psaux/pshints.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/psaux/pshints.c b/src/psaux/pshints.c index 991204c84..6f44d0adb 100644 --- a/src/psaux/pshints.c +++ b/src/psaux/pshints.c @@ -693,8 +693,10 @@ CF2_Fixed midpoint = cf2_hintmap_map( hintmap->initialHintMap, - ADD_INT32( secondHintEdge->csCoord, - firstHintEdge->csCoord ) / 2 ); + ADD_INT32( + firstHintEdge->csCoord, + SUB_INT32 ( secondHintEdge->csCoord, + firstHintEdge->csCoord ) / 2 ) ); CF2_Fixed halfWidth = FT_MulFix( SUB_INT32( secondHintEdge->csCoord, firstHintEdge->csCoord ) / 2, |