ref: 565f5a7d19d23aa7b3d6f917e5ef6b297b89f384
parent: c22a9aa245ed03516801a22894a235c88bbc5bc7
author: Wojciech Mamrak <[email protected]>
date: Mon Mar 27 05:19:14 EDT 2017
[sfnt] Minor improvement for handling kern tables. * src/sfnt/ttkern.c (tt_face_load_kern): Don't check for cross-stream kerning tables since we reject format 2 tables later on anyways. Modify code for limit test... (tt_face_get_kerning): ... to avoid a limit test here.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2017-03-27 Wojciech Mamrak <[email protected]>
+
+ [sfnt] Minor improvement for handling kern tables.
+
+ * src/sfnt/ttkern.c (tt_face_load_kern): Don't check for
+ cross-stream kerning tables since we reject format 2 tables later
+ on anyways.
+ Modify code for limit test...
+ (tt_face_get_kerning): ... to avoid a limit test here.
+
2017-03-27 Werner Lemberg <[email protected]>
[pcf] Fix compiler warnings.
--- a/src/sfnt/ttkern.c
+++ b/src/sfnt/ttkern.c
@@ -108,8 +108,8 @@
p_next = p_limit;
/* only use horizontal kerning tables */
- if ( ( coverage & ~8U ) != 0x0001 ||
- p + 8 > p_limit )
+ if ( ( coverage & 3U ) != 0x0001 ||
+ p + 8 > p_next )
goto NextTable;
num_pairs = FT_NEXT_USHORT( p );
@@ -214,8 +214,7 @@
if ( ( face->kern_avail_bits & mask ) == 0 )
goto NextTable;
- if ( p + 8 > next )
- goto NextTable;
+ FT_ASSERT( p + 8 <= next ); /* tested in tt_face_load_kern */
num_pairs = FT_NEXT_USHORT( p );
p += 6;