Files
harfbuzz/test/subset/meson.build
Behdad EsfahbodandClaude Opus 4.8 aad69a017b [instancer] Walk MVAR value records at the source valueRecordSize
MVAR::subset() copied the source valueRecordSize into the output
header but then walked the source array with a typed
VariationValueRecord pointer (8-byte stride) and embedded 8 bytes per
record. For a font whose MVAR uses value records longer than 8 bytes
(valueRecordSize > 8, which the spec and MVAR::sanitize() allow), every
record after the first was read from the wrong offset and the emitted
header described a record array that overlaps the table's own
ItemVariationStore, silently losing metric variations on partial
instancing.

Step through the source records with StructAtOffset at the table's own
valueRecordSize stride, the same way sanitize() and get_var() do, and
declare VariationValueRecord::static_size in the emitted header so it
always matches the 8-byte records that are written. Output for the
usual 8-byte fonts is byte-identical.

Adds a subset regression test (mvar_partial_instance_record_size) built
from NotoSans-VF.abc with its MVAR records re-padded to 12 bytes; its
expected instanced output is byte-identical to the 8-byte
mvar_partial_instance wght=300:600 file and it fails on the unpatched
tree.

Reported by Anthropic's OSS Scanner as ordinary bug ANT-2026-EJUT4BZL.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-08 14:33:10 -06:00

158 lines
3.5 KiB
Meson

tests = [
'basics',
'bidi',
'cmap',
'cmap14',
'cmap4_overflow',
'cmap_identity_delta',
'preprocess',
'full-font',
'cff-full-font',
'japanese',
'cff-japanese',
'cff.notoserifmyanmar',
'glyf_bug_3131',
'layout',
'layout.gpos',
'layout.gpos2',
'layout.gpos3',
'layout.gpos4',
'layout.gpos5',
'layout.gpos6',
'layout.gpos8',
'layout.gpos8.amiri',
'layout.gpos9',
'layout.gsub3',
'layout.gsub5',
'layout.gsub5_format2',
'layout.gsub6',
'layout.gsub6.empty_input_classdef',
'layout.gsub8',
'layout.gdef',
'layout.gdef.glyphset',
'layout.khmer',
'layout.context',
'layout.context_format2',
'layout.gdef-varstore',
'layout.gdef-attachlist',
'layout.markfilteringset',
'layout.notonastaliqurdu',
'layout.tinos',
'layout.duplicate_features',
'layout.feature_dedup',
'layout.feature_dedup_instance',
'layout.unsorted_featurelist',
'layout.drop_feature',
'no_layout_closure',
'sbix',
'colr',
'colr_glyphs',
'math',
'math_coverage_offset',
'subset_base',
'subset_base_v1',
# TODO: re-enable once colrv1 subsetting is stabilized.
# 'colrv1.notoemoji',
'colrv1',
'colrv1_subset_varstore',
'colr_with_components',
'cbdt',
'variable',
'glyph_names',
'glyph_map',
'post',
'32bit_var_store',
'pin_all_at_default',
'instantiate_base',
'instantiate_colrv1',
'colrv1_alpha_instance',
'instantiate_glyf',
'instantiate_cff2',
'instantiate_cff2_partial',
'downgrade_cff2',
'instantiate_cff2_tsb',
'full_instance',
'instance_feature_variations',
'instance_no_double_free',
'mvar_full_instance',
'instance_comp_glyph_empty_child',
'post_apply_mvar_delta',
'apply_cvar_delta',
'collect_name_ids',
'feature_params_variations',
'feature_params_alternate',
'instantiate_cff2_update_metrics',
'layout.empty_ligature_offset',
'glyf_partial_instancing',
'glyf_iup_retry',
'glyf_iup_large_contour',
'hvar_partial_instance_implicit_map',
'mvar_partial_instance',
'mvar_partial_instance_record_size',
'update_def_wght',
'feature_variations_partial_instance',
'gdef_partial_instance',
'value_format_partial_instance',
'feature_variation_instance_collect_lookups',
'sync_vmetrics',
'empty_region_vardata',
'colrv1_partial_instance',
'instantiate_gvar_padding',
'avar2_full_instance',
'avar2_null_varstore_partial_instance',
'subset_gvar_padding',
]
if get_option('experimental_api')
tests += [
'iftb_requirements',
'downgrade_cff2_iftb',
'retain-num-glyphs',
]
endif
repack_tests = [
'basic',
'prioritization',
'table_duplication',
'isolation',
'advanced_prioritization',
'space_splitting',
'duplicate_before_mutation',
]
run_test = find_program('run-tests.py')
foreach t : tests
fname = '@0@.tests'.format(t)
test(t, run_test,
args: [
hb_subset,
meson.current_source_dir() / 'data' / 'tests' / fname,
],
# as the tests are ran concurrently let's raise acceptable time here
# ideally better to break and let meson handles them in parallel
timeout: 500,
workdir: meson.current_build_dir() / '..' / '..',
protocol: 'tap',
suite: 'subset',
)
endforeach
run_repack_test = find_program('run-repack-tests.py')
foreach t : repack_tests
fname = '@0@.tests'.format(t)
test(t, run_repack_test,
args: [
hb_subset,
meson.current_source_dir() / 'data' / 'repack_tests' / fname,
],
workdir: meson.current_build_dir() / '..' / '..',
protocol: 'tap',
suite: ['subset', 'repack'],
)
endforeach