Commit Graph

11669 Commits

Author SHA1 Message Date
Qunxin Liu
430a67ceab [subset] COLRv1 struct definitions 2021-04-08 11:27:01 -06:00
Qunxin Liu
553ffaf682 [subset] fix for fuzzer testcase: https://oss-fuzz.com/testcase-detail/6382598554255360
avoid writing to null pointer
2021-04-08 09:54:48 -06:00
Qunxin Liu
4af5dacedc [subset] add fuzzer testcase 2021-04-07 13:02:04 -06:00
Garret Rieger
8b686afeb5 [subset] add unlikely(). 2021-04-06 12:34:44 -06:00
Garret Rieger
64122b5a44 [subset] don't visit lookup if covered glyph set has failed.
If covered glyph set is in error then the same lookup can be recursed into repeatedly potentially causing a fuzzer timeout. Fixes: https://oss-fuzz.com/testcase-detail/5416421032067072.
2021-04-06 12:34:44 -06:00
Garret Rieger
4ec18c85e6 [subset] add subsetting tests with drop hints and layout subsetting enabled. 2021-04-06 11:50:44 -06:00
Garret Rieger
6f98a8ed46 [subset] Anchor should only use format 1 when hints are dropped.
Refactor Anchor to have a subset method instead of copy. This also allows
use to use serialize_subset in several places which simplifies calculating
offset bases.
2021-04-06 11:50:44 -06:00
Garret Rieger
71d6d15600 [subset] clamp distance to prevent shifting outside of the limits of int64.
Fixes https://oss-fuzz.com/testcase-detail/4961171477233664.
2021-04-06 11:48:39 -06:00
Khaled Hosny
fcacd17748 [ot] Update _hb_glyph_info_is_default_ignorable_and_not_hidden()
Used _hb_glyph_info_substituted() similar to the change made to
_hb_glyph_info_is_default_ignorable() in
7686ff854b.
2021-04-06 11:47:06 -06:00
Garret Rieger
596f4258d0 [subset] copy Lookup::markFilteringSet when subseting. 2021-04-02 15:33:52 -06:00
Behdad Esfahbod
d3a2f999e4 Fix up build
This was left out; oops.
2021-04-02 08:33:03 -06:00
Garret Rieger
c35d786397 [subset] never drop the 'pref' feature.
Never ever drop feature 'pref', even if it's empty. Harfbuzz uses it to choose the shaper for Khmer.
2021-04-01 16:27:35 -06:00
Behdad Esfahbod
092094f705 Use as_array() and range loops in a few places 2021-04-01 16:02:54 -06:00
Garret Rieger
55e7f3fe32 [subset] Match FeatureVariationRecord dropping from fontTools.
Only drop records with no matching features that are at the end of the list. See: cab7d13dc0
2021-04-01 15:26:02 -06:00
Garret Rieger
f0c78e0282 [subset] don't drop features referenced in a feature variation substitution. 2021-04-01 15:26:02 -06:00
Garret Rieger
dae99b7769 [subset] don't keep FeatureVariationRecord's with no subsittutions. 2021-04-01 15:26:02 -06:00
Garret Rieger
85b0728783 Add full variable font subsetting test. 2021-04-01 15:26:02 -06:00
Behdad Esfahbod
c4b49075f6 Update CMakeLists.txt
Keep the warning.
2021-04-01 11:47:33 -06:00
Timo Suoranta
9945f32746 Test fix to export target include directories 2021-04-01 11:47:33 -06:00
Garret Rieger
b10741ca7f [subset] when closing glyphs in context lookups don't use a current glyph set if a lookup is already applied. 2021-03-31 21:03:33 -06:00
Garret Rieger
2773d05740 [subset] Add a test case using NotoNastaliqUrdu. 2021-03-31 21:03:33 -06:00
Garret Rieger
8ef4257dc8 [sanitize] change max ops to track number of bytes processed.
Counting bytes as the operations is likely to be a better proxy for how
much work processing the table will cost vs. the current approach of
counting the number of sub-objects.

This should allow checks for max features, max scripts, etc. to be removed.

I tested this change against the full collection of fonts at https://github.com/google/fonts
and a max ops factor of 3 was sufficient to successfully sanitize all of them.
2021-03-31 19:03:30 -06:00
Behdad Esfahbod
70110f6aaa Modify OffsetTo<>::sanitize() overflow check
The code in question was introduced in 70eb2ff682.
Rewrite it to not call sanitizer check_range() as we want to use
check_range() for byte accounting.

Part of https://github.com/harfbuzz/harfbuzz/pull/2923
2021-03-31 17:04:02 -06:00
Behdad Esfahbod
4dba749d83 Add SortedArray{16,32}Of<> 2021-03-31 16:09:39 -06:00
Behdad Esfahbod
5639e253f9 Add Array16Of<> 2021-03-31 16:04:43 -06:00
Behdad Esfahbod
2520a82df9 s/LArrayOf/Array32Of/g 2021-03-31 15:41:54 -06:00
Behdad Esfahbod
5efe360986 Rename (Unsized)OffsetListOf 2021-03-31 15:33:22 -06:00
Behdad Esfahbod
6c4e0491d7 s/OffsetArrayOf/Array16OfOffset16To/g 2021-03-31 15:31:32 -06:00
Behdad Esfahbod
1fc6b69aed s/UnsizedOffsetArrayOf/UnsizedArray16OfOffsetTo/g 2021-03-31 15:30:35 -06:00
Behdad Esfahbod
2a54c9f744 . 2021-03-31 15:26:42 -06:00
Behdad Esfahbod
c539afb08b [CFF] Use NNOffsetTo<> instead of OffsetTo<>
I'm pretty sure that's what is intended.
2021-03-31 13:28:25 -06:00
Behdad Esfahbod
9b4b58493b Fixup for recent OffsetTo<> changes 2021-03-31 13:27:21 -06:00
Behdad Esfahbod
ad28f973f3 Rename offset types to be explicit about their size
Add Offset16To<>, Offset24To<>, and Offset32To<> for most use-cases.
2021-03-31 13:00:07 -06:00
Garret Rieger
c5c13006a1 [subset] fix memory leaks found in https://oss-fuzz.com/testcase-detail/5179935334465536 2021-03-31 12:37:45 -06:00
Behdad Esfahbod
bd2950b393 Make VariationStore::get_delta(outer, inner) private 2021-03-31 11:36:36 -06:00
Behdad Esfahbod
934675a429 Use VarIdx in VariationDevice 2021-03-31 11:34:41 -06:00
Behdad Esfahbod
0f7f7536b9 [hvar] Change variation-index types from "unsigned int" to uint32_t 2021-03-31 11:31:49 -06:00
Behdad Esfahbod
9ffc46b8ff Add VarIdx 2021-03-31 11:26:18 -06:00
Behdad Esfahbod
2179281c40 Add Offset24 2021-03-31 11:20:21 -06:00
Behdad Esfahbod
b3159ed8d2 [util] Silence compiler warning 2021-03-30 20:52:56 -06:00
Andrzej Perczak
cab9d5a57d hb-config: Include config-override earlier
Currently config-override.h is included at the end of this file. This caused a problem for me while undefing HB_DISABLE_DEPRECATED, namely HB_IF_NOT_DEPRECATED was defined before actual undef took place and broke the whole build. I believe it would break builds for some other defines, too. Moving config-override.h include right after predefined configs is more sane and fixes all potential problems with includes.
2021-03-30 20:50:02 -06:00
Garret Rieger
adca4ce071 [subset] fixes https://oss-fuzz.com/testcase-detail/6173520787800064.
Caused by incorrect bounds check in glyph closure for context lookups.
2021-03-30 15:44:41 -06:00
Garret Rieger
9f77a0c1ff [subset] use hb_set_clear to avoid calling clear() on null pool set. 2021-03-30 15:12:52 -06:00
Garret Rieger
752e393ad2 [subset] avoid calling clear on null pool set. 2021-03-30 15:12:52 -06:00
Behdad Esfahbod
9ed5f04a70 [subset] Simplify recent out-of-memory fixes
By checking return status of map->set().
2021-03-29 18:14:30 -06:00
Behdad Esfahbod
a8f9f85a91 [map] Return success from ->set() 2021-03-29 18:13:22 -06:00
Garret Rieger
8741914a80 [subset] fix memory leak when map insert fails. 2021-03-29 18:02:32 -06:00
Behdad Esfahbod
2397689387 Remove hb_success_t
Was not rolled-out yet.  So just expand.
2021-03-29 17:49:16 -06:00
Behdad Esfahbod
7a2eda7817 Move code around 2021-03-29 17:49:12 -06:00
Behdad Esfahbod
bcb57dccaa [sanitize] Add short-circuit to ArrayOfM1
Like the sibling ArrayOf types.
2021-03-29 17:49:08 -06:00