Fix collect lookups logic of FeatureVariationRecord

As "Offset to a feature table substitution table, from beginning of the FeatureVariations table."
from https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2 the record should
match its sanitize logic not the reverse way.

Fixes https://crbug.com/oss-fuzz/20021 and https://crbug.com/oss-fuzz/20022
This commit is contained in:
Ebrahim Byagowi 2020-01-11 15:37:24 +03:30 committed by GitHub
parent 1a4c658b43
commit a32ecc15ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View File

@ -2363,10 +2363,11 @@ struct FeatureVariationRecord
{ {
friend struct FeatureVariations; friend struct FeatureVariations;
void collect_lookups (const hb_set_t *feature_indexes, void collect_lookups (const void *base,
const hb_set_t *feature_indexes,
hb_set_t *lookup_indexes /* OUT */) const hb_set_t *lookup_indexes /* OUT */) const
{ {
return (this+substitutions).collect_lookups (feature_indexes, lookup_indexes); return (base+substitutions).collect_lookups (feature_indexes, lookup_indexes);
} }
bool sanitize (hb_sanitize_context_t *c, const void *base) const bool sanitize (hb_sanitize_context_t *c, const void *base) const
@ -2423,7 +2424,7 @@ struct FeatureVariations
hb_set_t *lookup_indexes /* OUT */) const hb_set_t *lookup_indexes /* OUT */) const
{ {
for (const FeatureVariationRecord& r : varRecords) for (const FeatureVariationRecord& r : varRecords)
r.collect_lookups (feature_indexes, lookup_indexes); r.collect_lookups (this, feature_indexes, lookup_indexes);
} }
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const