diff options
-rw-r--r-- | src/cairo-ft-font.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index 975f9d226..0dfe9bea6 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -1189,6 +1189,14 @@ _get_bitmap_surface (FT_Bitmap *bitmap, bitmap->pixel_mode == FT_PIXEL_MODE_GRAY) { stride = bitmap->pitch; + + /* We don't support stride not multiple of 4. */ + if (stride & 3) + { + assert (!own_buffer); + goto convert; + } + if (own_buffer) { data = bitmap->buffer; } else { @@ -1224,6 +1232,7 @@ _get_bitmap_surface (FT_Bitmap *bitmap, #endif case FT_PIXEL_MODE_GRAY2: case FT_PIXEL_MODE_GRAY4: + convert: if (!own_buffer && library) { /* This is pretty much the only case that we can get in here. */ |