Files
harfbuzz/test/fuzzing
Behdad EsfahbodandClaude Opus 4.8 a5235968bb [subset] Collect lookup-variation feature indices once in dedup
_GSUBGPOS_find_duplicate_features() compared every pair of same-tag
retained features and, for each pair, called
FeatureVariations::has_lookup_variations() twice -- a linear walk of the
FeatureVariations 1.1 LookupVariationRecord array -- so a font cost
features^2 x records with no work limit (31 s for a 144 KB font).

The FeatureVariationRecord half of the same question is already answered
once up front via collect_feature_indices() into the variable_features
set, so do the same for the LookupVariationRecord half:
has_lookup_variations() becomes collect_lookup_variation_feature_indices(),
called once before the loop, and the per-pair test only consults the
set.  It is collected regardless of all_axes_pinned because the old code
consulted the records in both cases, so dedup decisions are unchanged
for fonts with sorted records; the only behavioural difference is that a
record sitting after one with a larger featureIndex (which the old early
break skipped) now also keeps its feature distinct, which is the
conservative direction.  has_lookup_variations() had no other callers.

The remaining F^2/2 same-tag pair loop is pre-existing and not part of
this finding.

A timing-only regression font is added under test/fuzzing/fonts/.

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-Z3B8ASPA.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-30 15:35:53 -06:00
..
2023-05-27 01:16:46 +02:00
2025-04-06 02:34:48 -06:00

Security Fuzzers

To build the fuzzers with libFuzzer to perform actual fuzzing, build with:

CXX=clang++ CXXFLAGS="-fsanitize=address,fuzzer-no-link" meson fuzzbuild --default-library=static -Dfuzzer_ldflags="-fsanitize=address,fuzzer"

ninja -Cfuzzbuild

Then, run the fuzzer like this:

fuzzbuild/test/fuzzing/hb-{shape,raster,vector,subset,repacker,depend}-fuzzer [-max_len=2048] [CORPUS_DIR]

Where max_len specifies the maximal length of font files to handle. The smaller the faster.

Note: The depend fuzzer requires -Ddepend_api=true meson option.

For more details consult the following locations:

Depend Closure Parity Test

The hb-depend-closure-parity test is distinct from the security fuzzers. While security fuzzers test robustness against malformed input, the closure parity test validates correctness by emulating the glyph closure calculation used for subsetting with one generated from the dependency graph to avoid implementation divergence. It should only be run on valid fonts.