[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
diff --git a/ChangeLog b/ChangeLog
index 2b6ee36..0d0e8f3 100644
--- 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.
diff --git a/src/sfnt/ttcolr.c b/src/sfnt/ttcolr.c
index 632547f..fa58a90 100644
--- 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;