[truetype] Sanitizer fix, second try.

* src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary
tests and use only one slot more.
This commit is contained in:
Werner Lemberg 2016-07-19 21:35:58 +02:00
parent 9f6426eb16
commit 7f63105c07
2 changed files with 11 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2016-07-19 Werner Lemberg <wl@gnu.org>
[truetype] Sanitizer fix, second try.
* src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary
tests and use only one slot more.
2016-07-19 Werner Lemberg <wl@gnu.org>
[truetype] Sanitizer fix.

View File

@ -159,9 +159,9 @@
}
/* in the nested loops below we increase `i' twice; */
/* it is faster to simply allocate two more slots */
/* it is faster to simply allocate one more slot */
/* than to add another test within the loop */
if ( FT_NEW_ARRAY( points, n + 2 ) )
if ( FT_NEW_ARRAY( points, n + 1 ) )
return NULL;
*point_cnt = n;
@ -182,7 +182,7 @@
{
first += FT_GET_USHORT();
points[i++] = first;
if ( i == n )
if ( i >= n )
break;
}
}
@ -195,7 +195,7 @@
{
first += FT_GET_BYTE();
points[i++] = first;
if ( i == n )
if ( i >= n )
break;
}
}