smooth: Exclude 16-bit system in invalid pitch/height check.
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
diff --git a/ChangeLog b/ChangeLog
index 35f93c0..e1eadc8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2009-07-31 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+ smooth: Exclude 16-bit system in invalid pitch/height check.
+
+ * src/smooth/ftsmooth.c (ft_smooth_render_generic):
+ pitch and height are typed as FT_UInt but checked to fit
+ 16-bit range, to avoid the overflows. On 16-bit system,
+ this checking inserts a conditional that never occurs.
+
+2009-07-03 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
cff: Type large constants > 0x7FFF as long for 16-bit systems.
* src/cff/cffload.c (cff_charset_load): Type large
diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c
index 3d3d30a..eed6353 100644
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -196,6 +196,8 @@
#endif
+#if FT_UINT_MAX > 0xFFFFU
+
/* Required check is ( pitch * height < FT_ULONG_MAX ), */
/* but we care realistic cases only. Always pitch <= width. */
if ( width > 0xFFFFU || height > 0xFFFFU )
@@ -205,6 +207,8 @@
return Smooth_Err_Raster_Overflow;
}
+#endif
+
bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
bitmap->num_grays = 256;
bitmap->width = width;