diff options
author | Werner Lemberg <wl@gnu.org> | 2017-09-05 23:02:04 +0200 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2017-09-05 23:02:04 +0200 |
commit | a3dd6d99a4c9f61667e5c996c0997cdd0207fc73 (patch) | |
tree | f14be91c05ad227f827fdb96bfcd13ba9cb98626 /src/base/ftbitmap.c | |
parent | 7d017ba810d0b29a941f83188ac39cf3c8d52a48 (diff) | |
download | freetype2-a3dd6d99a4c9f61667e5c996c0997cdd0207fc73.tar.gz |
Fix multiple calls of `FT_Bitmap_Convert'.
The documentation of `FT_Bitmap_Convert' says that multiple calls do
proper reallocation of the target FT_Bitmap object. However, this
failed for the sequence
non-empty bitmap
empty bitmap
non-empty bitmap
Reason was that `FT_Bitmap_Convert' only reallocated the bitmap
buffer if it became too small; it didn't make the buffer smaller.
For an empty bitmap following a non-empty one, only the buffer
dimension got set to zero, without deallocation. If the next call
was a non-empty buffer again, an assertion in `ft_mem_qrealloc' was
triggered.
* src/base/ftbitmap.c (FT_Bitmap_Convert): Always reallocate target
buffer to the correct size.
* docs/CHANGES: Document it.
Diffstat (limited to 'src/base/ftbitmap.c')
-rw-r--r-- | src/base/ftbitmap.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c index ee50c2f30..e567a0453 100644 --- a/src/base/ftbitmap.c +++ b/src/base/ftbitmap.c @@ -534,8 +534,7 @@ (FT_ULong)target->rows > FT_ULONG_MAX / (FT_ULong)target_pitch ) return FT_THROW( Invalid_Argument ); - if ( target->rows * (FT_ULong)target_pitch > old_size && - FT_QREALLOC( target->buffer, + if ( FT_QREALLOC( target->buffer, old_size, target->rows * (FT_UInt)target_pitch ) ) return error; |