[cff] Integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2109 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2110 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2122 * src/cff/cf2blues.c (cf2_blues_init): Use OVERFLOW_SUB_INT32. * src/cff/cf2hints.c (cf2_hintmap_map): Synchronize if-else branches.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
diff --git a/ChangeLog b/ChangeLog
index 6442e87..8d4e316 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2017-06-06 Werner Lemberg <wl@gnu.org>
+
+ [cff] Integer overflow.
+
+ Reported as
+
+ https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2109
+ https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2110
+ https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2122
+
+ * src/cff/cf2blues.c (cf2_blues_init): Use OVERFLOW_SUB_INT32.
+
+ * src/cff/cf2hints.c (cf2_hintmap_map): Synchronize if-else
+ branches.
+
2017-06-05 Werner Lemberg <wl@gnu.org>
[cff] Integer overflow.
diff --git a/src/cff/cf2blues.c b/src/cff/cf2blues.c
index a94254d..262be83 100644
--- a/src/cff/cf2blues.c
+++ b/src/cff/cf2blues.c
@@ -194,8 +194,9 @@
blues->zone[blues->count].csTopEdge =
cf2_blueToFixed( blueValues[i + 1] );
- zoneHeight = blues->zone[blues->count].csTopEdge -
- blues->zone[blues->count].csBottomEdge;
+ zoneHeight = OVERFLOW_SUB_INT32(
+ blues->zone[blues->count].csTopEdge,
+ blues->zone[blues->count].csBottomEdge );
if ( zoneHeight < 0 )
{
diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c
index d7938c9..e326c1b 100644
--- a/src/cff/cf2hints.c
+++ b/src/cff/cf2hints.c
@@ -332,7 +332,8 @@
{
/* special case for points below first edge: use uniform scale */
return OVERFLOW_ADD_INT32(
- FT_MulFix( csCoord - hintmap->edge[0].csCoord,
+ FT_MulFix( OVERFLOW_SUB_INT32( csCoord,
+ hintmap->edge[0].csCoord ),
hintmap->scale ),
hintmap->edge[0].dsCoord );
}