diff --git a/src/hb-ot-var-gvar-table.hh b/src/hb-ot-var-gvar-table.hh index ab53f0c10..1dee8d188 100644 --- a/src/hb-ot-var-gvar-table.hh +++ b/src/hb-ot-var-gvar-table.hh @@ -299,21 +299,21 @@ struct GlyphVariationData uint16_t run_count = (control & POINT_RUN_COUNT_MASK) + 1; if (control & POINTS_ARE_WORDS) { + if (unlikely (p + run_count * HBUINT16::static_size > end)) return false; for (j = 0; j < run_count && i < count; j++, i++) { - if (unlikely (p + HBUINT16::static_size > end)) return false; n += *(const HBUINT16 *)p; - points[i] = n; + points.arrayZ[i] = n; p += HBUINT16::static_size; } } else { + if (unlikely (p + run_count > end)) return false; for (j = 0; j < run_count && i < count; j++, i++) { - if (unlikely (p + 1 > end)) return false; n += *p++; - points[i] = n; + points.arrayZ[i] = n; } } if (j < run_count) return false;