diff options
author | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2009-07-03 18:01:41 +0900 |
---|---|---|
committer | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2009-07-03 18:01:41 +0900 |
commit | 6c2176b86fd2e0bf22ae990ab787f6db1e518a2c (patch) | |
tree | abf639f20016b29487e82a13dcd499c40bb21f0b | |
parent | ac079164bd49df8e7ddd42772d2dc9113978acdd (diff) | |
download | freetype2-6c2176b86fd2e0bf22ae990ab787f6db1e518a2c.tar.gz |
smooth: Exclude 16-bit system in invalid pitch/height check.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | src/smooth/ftsmooth.c | 6 |
2 files changed, 15 insertions, 0 deletions
@@ -1,5 +1,14 @@ 2009-07-03 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 153cb1d88..31180be33 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -196,6 +196,10 @@ #endif +#if FT_UINT_MAX > 0xFFFFU + + /* if pitch or height is not FT_UInt, check must be enabled */ + if ( pitch > 0xFFFF || height > 0xFFFF ) { FT_ERROR(( "ft_smooth_render_generic: glyph too large: %d x %d\n", @@ -203,6 +207,8 @@ return Smooth_Err_Raster_Overflow; } +#endif + bitmap->pixel_mode = FT_PIXEL_MODE_GRAY; bitmap->num_grays = 256; bitmap->width = width; |