summaryrefslogtreecommitdiff
path: root/src/sfnt/ttcmap.c
diff options
context:
space:
mode:
authorBen Wagner <bungeman@google.com>2019-11-23 10:54:51 +0100
committerWerner Lemberg <wl@gnu.org>2019-11-23 10:54:51 +0100
commit3cb7b3f7cb35fe403195e5e5dd76c1a8fce2e59a (patch)
tree1bdf05b77872211f10e52530a163c022320106b7 /src/sfnt/ttcmap.c
parent2d1d60aac67e105e6b812aa4ed6448d277f985e2 (diff)
downloadfreetype2-3cb7b3f7cb35fe403195e5e5dd76c1a8fce2e59a.tar.gz
[sfnt] Avoid sanitizer warning (#57286).
* src/sfnt/ttcmap.c (tt_face_build_cmaps): Avoid possible `NULL + offset' computation. Tag `table' as `const'.
Diffstat (limited to 'src/sfnt/ttcmap.c')
-rw-r--r--src/sfnt/ttcmap.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index 683f3b181..a3acf780e 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -3764,16 +3764,16 @@
FT_LOCAL_DEF( FT_Error )
tt_face_build_cmaps( TT_Face face )
{
- FT_Byte* table = face->cmap_table;
- FT_Byte* limit = table + face->cmap_size;
+ FT_Byte* const table = face->cmap_table;
+ FT_Byte* limit;
FT_UInt volatile num_cmaps;
- FT_Byte* volatile p = table;
+ FT_Byte* volatile p = table;
FT_Library library = FT_FACE_LIBRARY( face );
FT_UNUSED( library );
- if ( !p || p + 4 > limit )
+ if ( !p || face->cmap_size < 4 )
return FT_THROW( Invalid_Table );
/* only recognize format 0 */
@@ -3786,6 +3786,7 @@
}
num_cmaps = TT_NEXT_USHORT( p );
+ limit = table + face->cmap_size;
for ( ; num_cmaps > 0 && p + 8 <= limit; num_cmaps-- )
{