Fix two undefined-behavior issues

Fixes https://github.com/harfbuzz/harfbuzz/issues/761
Fixes https://github.com/harfbuzz/harfbuzz/issues/762
This commit is contained in:
Behdad Esfahbod 2018-02-07 14:09:56 -06:00
parent b87cbe2bec
commit 6d7c6e19dc
2 changed files with 7 additions and 7 deletions

View File

@ -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<hmtx> {

View File

@ -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<Coverage>
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