From 6d7c6e19dc769cf9997b7c1f8a4598eb44ca0b3c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 7 Feb 2018 14:09:56 -0600 Subject: [PATCH] Fix two undefined-behavior issues Fixes https://github.com/harfbuzz/harfbuzz/issues/761 Fixes https://github.com/harfbuzz/harfbuzz/issues/762 --- src/hb-ot-hmtx-table.hh | 4 ++-- src/hb-ot-layout-gsubgpos-private.hh | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index 934acde77..eed489026 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -173,7 +173,7 @@ struct hmtxvmtx * be in the array, but that entry is * required. The last entry applies to * all subsequent glyphs. */ - FWORD leadingBearingX[VAR]; /* Here the advance is assumed +/*FWORD leadingBearingX[VAR];*/ /* Here the advance is assumed * to be the same as the advance * for the last entry above. The * number of entries in this array is @@ -187,7 +187,7 @@ struct hmtxvmtx * font to vary the side bearing * values for each glyph. */ public: - DEFINE_SIZE_ARRAY2 (0, longMetric, leadingBearingX); + DEFINE_SIZE_ARRAY (0, longMetric); }; struct hmtx : hmtxvmtx { diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 8a005f5a2..90546344d 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -1212,7 +1212,7 @@ struct Rule lookupCount.sanitize (c) && c->check_range (inputZ, inputZ[0].static_size * inputCount + - lookupRecordX[0].static_size * lookupCount)); + LookupRecord::static_size * lookupCount)); } protected: @@ -1222,10 +1222,10 @@ struct Rule HBUINT16 lookupCount; /* Number of LookupRecords */ HBUINT16 inputZ[VAR]; /* Array of match inputs--start with * second glyph */ - LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in +/*LookupRecord lookupRecordX[VAR];*/ /* Array of LookupRecords--in * design order */ public: - DEFINE_SIZE_ARRAY2 (4, inputZ, lookupRecordX); + DEFINE_SIZE_ARRAY (4, inputZ); }; struct RuleSet @@ -1556,10 +1556,10 @@ struct ContextFormat3 OffsetTo coverageZ[VAR]; /* Array of offsets to Coverage * table in glyph sequence order */ - LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in +/*LookupRecord lookupRecordX[VAR];*/ /* Array of LookupRecords--in * design order */ public: - DEFINE_SIZE_ARRAY2 (6, coverageZ, lookupRecordX); + DEFINE_SIZE_ARRAY (6, coverageZ); }; struct Context