Fix runtime errors found by clang's sanitizer (#47082).

* src/base/ftobjs.c (FT_Render_Glyph_Internal), src/base/ftoutln.c
(FT_Outline_Copy), src/cache/ftcsbits.c (ftc_sbit_copy_bitmap):
Properly handle empty input buffer.
This commit is contained in:
Werner Lemberg 2016-02-07 19:25:56 +01:00
parent 4c00dfb458
commit 0d053bac84
4 changed files with 20 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2016-02-07 Werner Lemberg <wl@gnu.org>
Fix runtime errors found by clang's sanitizer (#47082).
* src/base/ftobjs.c (FT_Render_Glyph_Internal), src/base/ftoutln.c
(FT_Outline_Copy), src/cache/ftcsbits.c (ftc_sbit_copy_bitmap):
Properly handle empty input buffer.
2016-02-07 Werner Lemberg <wl@gnu.org> 2016-02-07 Werner Lemberg <wl@gnu.org>
[cff] Minor. [cff] Minor.

View File

@ -4201,6 +4201,7 @@
MD5_Init( &ctx ); MD5_Init( &ctx );
if ( bitmap.buffer )
MD5_Update( &ctx, bitmap.buffer, rows * pitch ); MD5_Update( &ctx, bitmap.buffer, rows * pitch );
MD5_Final( md5, &ctx ); MD5_Final( md5, &ctx );

View File

@ -415,10 +415,13 @@
if ( source == target ) if ( source == target )
return FT_Err_Ok; return FT_Err_Ok;
if ( source->n_points )
{
FT_ARRAY_COPY( target->points, source->points, source->n_points ); FT_ARRAY_COPY( target->points, source->points, source->n_points );
FT_ARRAY_COPY( target->tags, source->tags, source->n_points ); FT_ARRAY_COPY( target->tags, source->tags, source->n_points );
}
if ( source->n_contours )
FT_ARRAY_COPY( target->contours, source->contours, source->n_contours ); FT_ARRAY_COPY( target->contours, source->contours, source->n_contours );
/* copy all flags, except the `FT_OUTLINE_OWNER' one */ /* copy all flags, except the `FT_OUTLINE_OWNER' one */

View File

@ -53,6 +53,8 @@
pitch = -pitch; pitch = -pitch;
size = (FT_ULong)pitch * bitmap->rows; size = (FT_ULong)pitch * bitmap->rows;
if ( !size )
return FT_Err_Ok;
if ( !FT_ALLOC( sbit->buffer, size ) ) if ( !FT_ALLOC( sbit->buffer, size ) )
FT_MEM_COPY( sbit->buffer, bitmap->buffer, size ); FT_MEM_COPY( sbit->buffer, bitmap->buffer, size );