ref: 24848a3d58cdd3ffd40ef3ddd68407d18f678b52
parent: 8667042997cb9095d3c925417b29f5a3163ab352
author: Werner Lemberg <[email protected]>
date: Tue Jun 6 08:05:04 EDT 2017
[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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2017-06-06 Werner Lemberg <[email protected]>
+
+ [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 <[email protected]>
[cff] Integer overflow.
--- 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 )
{
--- 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 );
}