Commit Graph

48 Commits

Author SHA1 Message Date
Garret Rieger e4fff64ce3 [repacker] check duplicate() for success.
Fixes fuzzer testcase https://oss-fuzz.com/testcase-detail/5475787333828608.
2023-01-23 18:37:13 -07:00
Behdad Esfahbod ed023f66df Enable -Wformat-signedness
And fix the codebase.
2023-01-12 17:04:24 -07:00
Garret Rieger 35233d2514 [repacker] fix fuzzer reported stack overflow.
Fixes https://oss-fuzz.com/testcase-detail/6014493291577344.
2022-12-07 10:32:56 -07:00
Garret Rieger f1d3489388 [repacker] bail on failure to alloc assigned_bytes set.
Fixes fuzzer issue https://oss-fuzz.com/testcase-detail/5390364397928448.
2022-12-05 14:13:47 -07:00
Garret Rieger 239a5aca02 [repacker] don't allow references to the null object in graph.
Fixes fuzzer issue https://oss-fuzz.com/testcase-detail/6714085985353728
2022-12-05 14:13:47 -07:00
Garret Rieger de5a621322 [repacker] enforce root node having no incoming edges. 2022-12-01 23:37:16 +00:00
Garret Rieger 30e405e470 [repacker] ensure link obj indices are valid. 2022-12-01 22:12:59 +00:00
Garret Rieger 554ed06fac [repacker] add cycle detection to the graph sort.
This allows us to bail early if the graph is not acyclic.
2022-12-01 21:52:37 +00:00
Garret Rieger 9e99d08470 [repacker] validate link widths during repacker setup. 2022-12-01 20:17:41 +00:00
Garret Rieger edf7a29595 [repacker] Validate link positions before running the repacker. 2022-12-01 20:17:41 +00:00
Garret Rieger deca30b268 [repacker] get repacker fuzzer working.
Additionally add helper method that allows a graph to be saved as a fuzzer seed.
2022-12-01 20:17:40 +00:00
Garret Rieger 985b19f678 [repacker] begin implementing a fuzzer for the repacker api. 2022-12-01 20:17:39 +00:00
Behdad Esfahbod 915c1a00cf [vector] Add remove_unordered
Saves 5% in NotoNastaliq/1000 subset benchmark.
2022-11-26 14:48:57 -07:00
Joel Auterson c813f84235 Make build work for arm-none-eabi 2022-10-21 11:09:35 -06:00
Garret Rieger 99f4668e19 [repacker] use mutable copies of Coverage/ClassDef in MarkBasePos shrink operation.
Also make mutable copies (when needed) of the top level subtables during a split operation.
2022-09-30 10:58:50 -06:00
Behdad Esfahbod 56c4670935 [subset] Fix compiler warning
Fixes https://github.com/harfbuzz/harfbuzz/issues/3823
2022-09-20 17:40:13 -06:00
Garret Rieger 29e3b2467e [repacker] optimzie remove_real_links as it's a hot method. 2022-08-18 01:19:54 +00:00
Garret Rieger 46b5dbd7ce [repacker] optimize index_for_offset. 2022-08-18 01:18:16 +00:00
Garret Rieger ac1a853abc [repacker] implement sanitize methods for MarkBasePos. 2022-08-18 00:55:47 +00:00
Garret Rieger a3ed9f9099 [repacker] fix graph comparison, and mark base pos generation for the tests. 2022-08-17 23:39:11 +00:00
Garret Rieger 1405f96b6f [repacker] change run_resolve_overflow_test to check for graph equivalence.
Replaces a check for an exact match on the final serialized bytes. The previous check enforced equivalent topological sorting between result and expected, but we only really care that the graph's are equivalent and don't overflow.
2022-08-15 23:48:00 +00:00
Garret Rieger 07fd0528c0 [repacker] add graph equality check.
Does not compare topological sorting, but looks for equivalence of the two graphs.
2022-08-15 23:16:51 +00:00
Garret Rieger 5cf2a25a60 [repacker] Expose on internal method in the repacker that allows the caller to pass in/out a graph.
Will be used in testing so we can compare graphs instead of packed result.
2022-08-15 22:49:24 +00:00
Garret Rieger 0083fd109c [repacker] add as_table() helper to graph. 2022-08-11 22:09:46 +00:00
Garret Rieger b00eb77682 [repack] Add add_link helper to graph. 2022-08-11 20:33:21 +00:00
Garret Rieger 1acd2a8bf9 [repacker] implement MarkBasePosFormat1::clone_range. 2022-08-11 20:22:31 +00:00
Garret Rieger 5d824c09c0 [repacker] during table splits don't mutate shared coverage/classdef in place.
If other subtables are sharing coverage with a subtable being split we have to duplicate the coverage/classdef tables before they are modified during the shrink operation.
2022-08-05 01:37:14 +00:00
Garret Rieger 3b91fb2a9f [repacker] cleanup todo. 2022-07-29 22:21:31 +00:00
Garret Rieger fb3f6ad7c0 [repacker] ensure lookup map is updated when lookup memory location changes. 2022-07-29 22:21:31 +00:00
Garret Rieger 65afed047d [repacker] more bug fixes. 2022-07-29 22:21:31 +00:00
Garret Rieger 1002a3dcd3 [repacker] bug fixes. 2022-07-29 22:21:31 +00:00
Garret Rieger 29cb8818cd [repacker] new coverage serialization in PairPosFormat1. 2022-07-29 22:21:31 +00:00
Garret Rieger 8d63f60e5b [repack] add graph_t::move_child helper function. 2022-07-29 22:21:31 +00:00
Garret Rieger 241ebc9354 [repacker] fix include paths. 2022-07-26 12:22:17 -06:00
Garret Rieger 9d0b2da51b [repacker] count subtable size in each group of consecutive layers for extension promotion decisions.
Enforce that the following groups are all <64k in size:
- LookupList + Lookups
- Lookups + SubTables
- SubTables + Descendants
2022-07-26 12:22:17 -06:00
Garret Rieger 9db3beb721 [repacker] include LookupList size when calculating size of 16bit space for ext promotion decisions. 2022-07-26 12:22:17 -06:00
Garret Rieger ad0041f5f7 [repacker] Add basic version of the extension promotion selection algorithm. 2022-07-26 12:22:17 -06:00
Garret Rieger ae290ff4fe [repacker] add sanitization for GSUB/LookupList/Lookup during extension promotion. 2022-07-26 12:22:17 -06:00
Garret Rieger ce03c3538a [repacker] add make_extension_context_t. 2022-07-26 12:22:17 -06:00
Garret Rieger 815bb82b4d [repack] fix incorrect extension object bounds. 2022-07-26 12:22:17 -06:00
Garret Rieger 7e6f6c3e88 [repack] fix new node bounds. 2022-07-26 12:22:17 -06:00
Garret Rieger b1d38a6d0b [repack] WIP implement extension promotion mechanism. 2022-07-26 12:22:17 -06:00
Garret Rieger 3f7a74ff40 [repacker] WIP extension promotion implementation. 2022-07-26 12:22:17 -06:00
Garret Rieger b4f561dbbf [subset] Add some comments to find_space_roots/find_32_bit_roots methods. 2022-07-06 18:49:23 +00:00
Garret Rieger 401066bf3d [subset] Prepare the repacker for handling 24bit offsets in GSUB/GPOS.
The boring expansion (https://github.com/be-fonts/boring-expansion-spec) plans to introduce 24bit offsets into GSUB/GPOS. This changes the repacker to treat 24 bit offsets similar to 32 bit offsets and assign the top level 24 bit offsets into spaces to improve packing.
2022-07-06 18:44:40 +00:00
Garret Rieger 2674962cf5 [repacker] Add comment to graph class. 2022-06-24 17:16:50 -06:00
Garret Rieger 7078560e33 [repacker] extract graph serialization code into a seperate file. 2022-06-24 17:16:50 -06:00
Garret Rieger 20b02a672d [repacker] Begin splitting up the repacker implementation into several files. 2022-06-24 17:16:50 -06:00