Commit Graph

24 Commits

Author SHA1 Message Date
Behdad Esfahbod 2c824d3644 [aat] Fix two wrongs that made a right before!
Unfortunately our static asserts (DEFINE_SIZE_STATIC) don't actually
fail when used in templates, thanks to SFINAE.  Le sighs.

Probably fixes https://oss-fuzz.com/v2/testcase-detail/5740171484463104
2018-10-11 16:43:05 -04:00
Behdad Esfahbod 22955b23cd [kerx] Start fleshing out Format6 2018-10-10 19:58:20 -04:00
Behdad Esfahbod 4c3b19d52e Support HBUINT32 BinSearchArrayOf 2018-10-07 22:30:42 -04:00
Behdad Esfahbod 456a68c506 Move code 2018-10-07 22:28:45 -04:00
Behdad Esfahbod 606bf57430 Revert forcing use of single-parameter static_assert()
Some clang versions define static_assert as a macro apparently, so we cannot
redefine it...

This reverts commit 94bfea0ce6.
This reverts commit 4e62627831.
2018-09-16 19:34:39 +02:00
Behdad Esfahbod 4e62627831 Enforce single-param static_assert() only
So we don't accidentally break it again.
2018-09-16 18:09:36 +02:00
Behdad Esfahbod ebd50b3c83 Fix static_assert 2018-09-16 17:57:12 +02:00
Behdad Esfahbod 10642b3fbf Disallow null-enabled offsets to unsized structures...
...like UnsizedArrayOf<>.

This fixes a class of crasher bugs, mostly with color and AAT tables.  We
cannot use nullable offsets to varsized data that does not declare min_size,
because it's nost safe to use our fixed-size null pool for types that have
their size external.  So, use non_null'able offsets for these.

A further enhancement would be to make use of min_size in Null<> itself.
Will try that after.
2018-09-15 19:43:33 +02:00
Behdad Esfahbod f8ccb545c4 [dfont] Disable null-processsing for offsets
An offset to unsized arrayis not safe to be redirected to our fixed-sized
null pool.  Plus, we want to reject, not repair, bad-looking dfonts.
2018-09-14 18:59:53 +02:00
Behdad Esfahbod 3789c557ca [dfont] Solve the mystery +2 offset thing!
Previously, ResourceForkHeader was defined as 30 bytes, having the typeCountM1 as last member.
There was a mysterious offset-by-2 in the code, derived from FontTools and JDK code this was
ported from.

In testing, I observed that typeListZ offset is actually 28.  Suggesting that the typeCountM1
does NOT actually belong to ResourceForkHeader, but belongs to the array itself.  Adjusting for
that resolves the mystery +2 offset hack, so everything is clean and good now.

This, concludes my dfont hacking.  The code looks great now, and I'm happy to leave it.
Fuzzers might disagree though, we will see!
2018-09-13 20:32:13 +02:00
Behdad Esfahbod effc7ced72 Rename HeadlessArrayOf::len to lenP1
So it doesn't accidentally match our templates, etc.
2018-09-13 20:21:54 +02:00
Behdad Esfahbod 29faebe911 Allow Offset<>'s that have no 0==null 2018-09-13 18:47:25 +02:00
Behdad Esfahbod 361fc26861 Fix OffsetTo::sanitize() after reshuffling 2018-09-13 16:47:33 +02:00
Behdad Esfahbod 4c6b0fb5f6 OffsetTo::sanitize() Add version with three user_data 2018-09-13 16:39:30 +02:00
Behdad Esfahbod a73bea69c5 OffsetTo::sanitize() more shuffling 2018-09-13 16:31:31 +02:00
Behdad Esfahbod b482e5231c OffsetTo::sanitize() reshuffling 2018-09-13 16:29:49 +02:00
Behdad Esfahbod bccf3e1827 Minor 2018-09-11 01:04:50 +02:00
Behdad Esfahbod dff2c45f1e Port rest from VAR to UnsizedArrayOf<> 2018-09-11 01:01:08 +02:00
Behdad Esfahbod 9507b05a7a Simplify sanitize->check_array()
Fix a bug in CBDT sanitize, and redundant check in avar.
2018-09-10 23:18:23 +02:00
Behdad Esfahbod fda994e1d4 Use enum instead of "static const" in class scope
Technically, static const needs an out-of-class definition.  Eg:

  CXXLD    libharfbuzz-subset.la
Undefined symbols for architecture x86_64:
  "OT::FeatureVariationRecord::min_size", referenced from:
      bool OT::GSUBGPOS::subset<OT::PosLookup>(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o
      bool OT::GSUBGPOS::subset<OT::SubstLookup>(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o
  "OT::Record<OT::LangSys>::min_size", referenced from:
      OT::Script::subset(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o
  "OT::IntType<unsigned short, 2u>::min_size", referenced from:
      OT::Script::subset(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o
      OT::RecordListOf<OT::Feature>::subset(hb_subset_context_t*) const  in libharfbuzz_subset_la-hb-subset.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[4]: *** [libharfbuzz-subset.la] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Exited with code 2
2018-09-07 15:02:57 -04:00
Behdad Esfahbod 49c44b58f6 [subset] Fix serialize_subset() calls
Ouch.
2018-09-03 16:37:17 -07:00
Behdad Esfahbod bfa72a9a72 [subset] Towards GSUB/GPOS subsetting
Add subset() call for GSUBGPOS struct and its dependencies.
Not hooked up anywhere.
2018-09-01 18:34:50 -07:00
Behdad Esfahbod d1f29908c2 [subset] Add hb_subset_context_t<> 2018-08-31 16:31:00 -07:00
Behdad Esfahbod c77ae40852 Rename hb-*private.hh to hb-*.hh
Sorry for the noise, downstream custom builders.  Please adjust.
2018-08-25 22:36:36 -07:00