ref: 8cee1dde4e708b1d4a9f028f3ac6cca99495d729
parent: 7e1b39f6cd1f8e14d45592c9b192ade643d8d9de
author: Dominik Röttsches <[email protected]>
date: Tue Dec 17 09:12:38 EST 2019
Fix more UBSan warnings on adding offset to nullptr (#57432). * src/truetype/ttinterp.c (Ins_LOOPCALL), src/psaux/psft.c (cf2_initLocalRegionBuffer): Use `FT_OFFSET'.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2019-12-21 Dominik Röttsches <[email protected]>
+
+ Fix more UBSan warnings on adding offset to nullptr (#57432).
+
+ * src/truetype/ttinterp.c (Ins_LOOPCALL), src/psaux/psft.c
+ (cf2_initLocalRegionBuffer): Use `FT_OFFSET'.
+
2019-12-16 Werner Lemberg <[email protected]>
[truetype] Fix UBSan warnings on adding offsets to nullptr.
--- a/src/psaux/psft.c
+++ b/src/psaux/psft.c
@@ -823,7 +823,7 @@
/* The CID driver stores subroutines with seed bytes. This */
/* case is taken care of when decoder->subrs_len == 0. */
if ( decoder->locals_len )
- buf->end = buf->start + decoder->locals_len[idx];
+ buf->end = FT_OFFSET( buf->start, decoder->locals_len[idx] );
else
{
/* We are using subroutines from a CID font. We must adjust */
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -4062,7 +4062,7 @@
/* */
/* If this isn't true, we need to look up the function table. */
- def = exc->FDefs + F;
+ def = FT_OFFSET( exc->FDefs, F );
if ( exc->maxFunc + 1 != exc->numFDefs || def->opc != F )
{
/* look up the FDefs table */
@@ -4070,7 +4070,7 @@
def = exc->FDefs;
- limit = def + exc->numFDefs;
+ limit = FT_OFFSET( def, exc->numFDefs );
while ( def < limit && def->opc != F )
def++;