From 11d4ce23ac55a7d881bba5214c47922c05127242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20R=C3=B6ttsches?= Date: Mon, 9 Dec 2019 12:40:42 +0200 Subject: [PATCH] Fix more UBSan warnings on adding offset to nullptr (#57384) * src/smooth/ftsmooth.c (ft_smooth_render_generic), src/psaux/psobjs.c (ps_table_add): Use `FT_OFFSET'. --- ChangeLog | 7 +++++++ src/psaux/psobjs.c | 2 +- src/smooth/ftsmooth.c | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0506b2a96..db51329e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2019-12-09 Dominik Röttsches + + Fix more UBSan warnings on adding offset to nullptr (#57384). + + * src/smooth/ftsmooth.c (ft_smooth_render_generic), + src/psaux/psobjs.c (ps_table_add): Use `FT_OFFSET'. + 2019-12-05 Werner Lemberg * src/truetype/ttinterp.c (TT_RunIns): Use `FT_OFFSET'. diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 8bfdb9233..5fb23b135 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -214,7 +214,7 @@ } /* add the object to the base block and adjust offset */ - table->elements[idx] = table->block + table->cursor; + table->elements[idx] = FT_OFFSET( table->block, table->cursor ); table->lengths [idx] = length; FT_MEM_COPY( table->block + table->cursor, object, length ); diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index cd034d2b4..dcaad35e3 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -188,7 +188,7 @@ /* implode outline if needed */ { FT_Vector* points = outline->points; - FT_Vector* points_end = points + outline->n_points; + FT_Vector* points_end = FT_OFFSET( points, outline->n_points ); FT_Vector* vec; @@ -207,7 +207,7 @@ /* deflate outline if needed */ { FT_Vector* points = outline->points; - FT_Vector* points_end = points + outline->n_points; + FT_Vector* points_end = FT_OFFSET( points, outline->n_points ); FT_Vector* vec;