ref: 2a6665a4c04913bbe088af48db4eb293d498043c
parent: 7ca7da9d13bbd7a8a2ca91a3250fb66ef25c8650
author: Ben Wagner <bungeman@chromium.org>
date: Tue Jun 1 11:25:31 EDT 2021
[sfnt] Fix fallout from 2021-05-29 change. * src/sfnt/ttcolr.c (find_base_glyph_record, find_base_glyph_v1_record): Adjust binary search. Needs to be updated with change to unsigned.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2021-06-02 Ben Wagner <bungeman@chromium.org>
+ Werner Lemberg <wl@gnu.org>
+
+ [sfnt] Fix fallout from 2021-05-29 change.
+
+ * src/sfnt/ttcolr.c (find_base_glyph_record,
+ find_base_glyph_v1_record): Adjust binary search.
+
+ Needs to be updated with change to unsigned.
+
2021-06-02 Werner Lemberg <wl@gnu.org>
* src/autofit/aflatin.c (af_latin_metrics_scale_dim): Fix tracing.
--- a/src/sfnt/ttcolr.c
+++ b/src/sfnt/ttcolr.c
@@ -233,10 +233,10 @@
BaseGlyphRecord* record )
{
FT_UInt min = 0;
- FT_UInt max = num_base_glyph - 1;
+ FT_UInt max = num_base_glyph;
- while ( min <= max )
+ while ( min < max )
{
FT_UInt mid = min + ( max - min ) / 2;
FT_Byte* p = base_glyph_begin + mid * BASE_GLYPH_SIZE;
@@ -247,7 +247,7 @@
if ( gid < glyph_id )
min = mid + 1;
else if (gid > glyph_id )
- max = mid - 1;
+ max = mid;
else
{
record->gid = gid;
@@ -590,16 +590,16 @@
static FT_Bool
- find_base_glyph_v1_record ( FT_Byte * base_glyph_begin,
- FT_UInt num_base_glyph,
- FT_UInt glyph_id,
- BaseGlyphV1Record *record )
+ find_base_glyph_v1_record( FT_Byte * base_glyph_begin,
+ FT_UInt num_base_glyph,
+ FT_UInt glyph_id,
+ BaseGlyphV1Record *record )
{
FT_UInt min = 0;
- FT_UInt max = num_base_glyph - 1;
+ FT_UInt max = num_base_glyph;
- while ( min <= max )
+ while ( min < max )
{
FT_UInt mid = min + ( max - min ) / 2;
@@ -616,7 +616,7 @@
if ( gid < glyph_id )
min = mid + 1;
else if (gid > glyph_id )
- max = mid - 1;
+ max = mid;
else
{
record->gid = gid;