diff --git a/ChangeLog b/ChangeLog index 23c35958c..7019ab1b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2019-11-23 John Stracke + Werner Lemberg + + [base] Fix `NULL + offset' sanitizer warnings (#57194). + + * src/base/ftgloadr.c (FT_GlyphLoader_Adjust_Points, + FT_GlyphLoader_Adjust_Subglyphs): Use `FT_OFFSET'. + (FT_GlyphLoader_CreateExtra): Add short cut if some values are zero. + 2019-11-23 Werner Lemberg * include/freetype/internal/ftmemory.h (FT_OFFSET): New macro. diff --git a/src/base/ftgloadr.c b/src/base/ftgloadr.c index bfeed461a..c076dcc34 100644 --- a/src/base/ftgloadr.c +++ b/src/base/ftgloadr.c @@ -146,9 +146,9 @@ FT_Outline* current = &loader->current.outline; - current->points = base->points + base->n_points; - current->tags = base->tags + base->n_points; - current->contours = base->contours + base->n_contours; + current->points = FT_OFFSET( base->points, base->n_points ); + current->tags = FT_OFFSET( base->tags, base->n_points ); + current->contours = FT_OFFSET( base->contours, base->n_contours ); /* handle extra points table - if any */ if ( loader->use_extra ) @@ -169,6 +169,10 @@ FT_Memory memory = loader->memory; + if ( loader->max_points == 0 || + loader->base.extra_points != NULL ) + return FT_Err_Ok; + if ( !FT_NEW_ARRAY( loader->base.extra_points, 2 * loader->max_points ) ) { loader->use_extra = 1; @@ -189,7 +193,7 @@ FT_GlyphLoad current = &loader->current; - current->subglyphs = base->subglyphs + base->num_subglyphs; + current->subglyphs = FT_OFFSET( base->subglyphs, base->num_subglyphs ); }