ref: 551bd3a90e352fa3a66ee7644c07440939c03d81
parent: 4270e9f3243079bb90b6af618ed4d4fd31266412
author: Werner Lemberg <wl@gnu.org>
date: Tue Dec 3 06:52:48 EST 2019
More nullptr offset UBSan warnings (#57331, #57347). * src/autofit/afcjk.c (af_cjk_hints_compute_segments), src/psaux/psft.c (cf2_getSeacComponent), src/truetype/ttinterp.c (Ins_UNKNOWN): Use `FT_OFFSET'.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2019-12-03 Werner Lemberg <wl@gnu.org>
+
+ More nullptr offset UBSan warnings (#57331, #57347).
+
+ * src/autofit/afcjk.c (af_cjk_hints_compute_segments),
+ src/psaux/psft.c (cf2_getSeacComponent), src/truetype/ttinterp.c
+ (Ins_UNKNOWN): Use `FT_OFFSET'.
+
2019-11-29 Dominik Röttsches <drott@chromium.org>
Avoid more nullptr offset UBSan warnings (#57316).
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -806,7 +806,7 @@
{
AF_AxisHints axis = &hints->axis[dim];
AF_Segment segments = axis->segments;
- AF_Segment segment_limit = segments + axis->num_segments;
+ AF_Segment segment_limit = FT_OFFSET( segments, axis->num_segments );
FT_Error error;
AF_Segment seg;
--- a/src/psaux/psft.c
+++ b/src/psaux/psft.c
@@ -700,7 +700,7 @@
FT_ASSERT( charstring + len >= charstring );
buf->start = charstring;
- buf->end = charstring + len;
+ buf->end = FT_OFFSET( charstring, len );
buf->ptr = buf->start;
return FT_Err_Ok;
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -7715,7 +7715,7 @@
Ins_UNKNOWN( TT_ExecContext exc )
{
TT_DefRecord* def = exc->IDefs;
- TT_DefRecord* limit = def + exc->numIDefs;
+ TT_DefRecord* limit = FT_OFFSET( def, exc->numIDefs );
for ( ; def < limit; def++ )