Commit Graph

315 Commits

Author SHA1 Message Date
Behdad Esfahbod 70eb2ff682 Check for offset overflows during sanitize 2016-12-02 19:51:23 -08:00
Behdad Esfahbod b92ba7bafc [CBDT] Use CHAR instead of int8_t 2016-12-02 15:21:43 -08:00
Behdad Esfahbod 587d46227a [ot-font] Start implementing 'post' table, for accessing glyph names 2016-04-30 19:20:56 +02:00
Behdad Esfahbod 6dd80faf0d Fix FixedVersion::to_int()
Ouch.  Had broken it in 9a13ed453e

Fixes https://github.com/behdad/harfbuzz/issues/238
Will add test soon.
2016-04-04 14:34:25 -07:00
Behdad Esfahbod 68b6296d33 Add F2DOT14 type 2016-03-01 16:41:53 +09:00
Behdad Esfahbod 9a13ed453e Make FixedVersion a template 2016-02-22 15:38:44 +09:00
Behdad Esfahbod 53c47c8582 Increase sanitize edit count from 8 to 32
See previous commit.
2016-01-05 13:26:20 +00:00
Steven R. Loomis a13b023dbf AIX fixes
- use '-w' instead of '\<...\>' for check-header-guards
  grep manpage says these are the same

- put '-q' first in the grep options

- move VAR into hb-private.hh

- hb-font-private.hh - use [VAR] instead of [] for variable array
2015-12-12 17:44:44 -08:00
Behdad Esfahbod 14c2de3218 Limit max edits during sanitize to 8
Used to be 100.  If a tabe needs more than one or two edits, it's
probably completely bogus...

Might help with speeding up fuzzing for
https://github.com/behdad/harfbuzz/issues/157
2015-11-04 18:00:57 -08:00
Behdad Esfahbod ce889189c1 Fix two more -Wshadow warnings
https://bugzilla.mozilla.org/show_bug.cgi?id=1215894
2015-10-21 11:23:12 -02:00
Behdad Esfahbod ee9b0b6cb5 Fix another sanitize bug
Also discovered by "libFuzzer".
2015-10-09 14:23:15 -04:00
Behdad Esfahbod f396fbb000 Fix return value of sanitize when subformat is not readable
This is a fix on top of the previous issue fixed in
c917965b9e.

This was caught by "libFuzzer" testing.
2015-10-09 12:25:55 -04:00
Behdad Esfahbod 77a1a2bc18 Add hb_dispatch_context_t 2015-10-09 12:20:58 -04:00
Behdad Esfahbod b47159011c Define return_trace()
Not functional change (expected!).
2015-09-29 14:57:02 +01:00
Behdad Esfahbod 0299b45000 Make BYTE a real type 2015-08-21 12:44:36 +01:00
Behdad Esfahbod 5175300fba [layout] Fix comparison of GlyphID and hb_codepoint_t
Before, the IntType::cmp functions providing this and was truncating
the hb_codepoint_t to 16bits before comparison.  I have no idea how
this was never discovered, and I'm too lazy to try to reproduce this
with Pango (which uses non-16bit codepoint numbers for missing glyphs).
2015-02-25 15:43:34 -08:00
Behdad Esfahbod 7cce809cb1 Remove unused (and wrong as of a few commits ago) cmp() function 2015-02-25 15:43:34 -08:00
Behdad Esfahbod bbdd6fd21c Minor simpilfy BEInt 2015-02-25 15:43:32 -08:00
Behdad Esfahbod 88a399acdc Optimize IntType comparison to avoid branches for 16bit numbers 2015-02-25 15:43:32 -08:00
Behdad Esfahbod 37de2d5331 Minor simplify IntType 2015-02-25 15:43:31 -08:00
Behdad Esfahbod 095a1257cc [layout] Port sanitize() to use dispatch()
Needed some rework of Extension table.  Hopefully I got it right, and
the new template usage doesn't break any compilers...
2015-02-25 15:43:30 -08:00
Behdad Esfahbod de2118ed7a Make sanitize() a const method
This makes a lot of code safer.  We only try modifying the object in one
place, after making sure it's safe to do so.  So, do a const_cast<> in
that one place...
2015-02-25 15:43:28 -08:00
Behdad Esfahbod d5a5052098 Assert that blob length doesn't overflow address.
This will crash now, if blob was created with wrong length.
Check for that coming next commit.
2014-12-18 18:09:41 -08:00
Behdad Esfahbod 282b13f9b4 [sanitize] Improve debug output some more 2014-12-12 19:34:49 -08:00
Behdad Esfahbod 0766ee1f4e [sanitize] Improve debug output 2014-12-12 18:23:20 -08:00
Behdad Esfahbod 5a5640d850 Move code around 2014-10-14 21:26:13 -07:00
Behdad Esfahbod 666b42f73b Move macros around
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=84491
2014-10-14 21:24:59 -07:00
Behdad Esfahbod 7e8c389546 Minor warnings fixes
Some systems insist on -Wmissing-field-initializers.  We have too many,
by design.  Fix a few easy ones.
2014-07-25 11:23:17 -04:00
Behdad Esfahbod 7627100f42 Mark unsigned integer literals with the u suffix
Simplifies hb_in_range() calls as the type can be inferred.
The rest is obsessiveness, I admit.
2014-07-11 16:22:13 -04:00
Behdad Esfahbod 586b60622c Minor: final bits of cleanup 2014-06-27 15:39:47 -04:00
Behdad Esfahbod 51d9ba09bc Minor 2014-06-27 15:27:15 -04:00
Behdad Esfahbod 3084767e92 Minor: Remove LongArrayOf 2014-06-27 15:24:35 -04:00
Behdad Esfahbod 41ea594950 Minor: Remove LongSortedArrayOf 2014-06-27 15:23:18 -04:00
Behdad Esfahbod bb6ecf2ce5 Minor: Remove LongOffsetArrayOf and LongOffsetLongArrayOf 2014-06-27 15:21:08 -04:00
Behdad Esfahbod 99d2817123 Minor: Remove GenericOffset 2014-06-27 15:19:15 -04:00
Behdad Esfahbod 9da552dcc5 Minor: Remove some GenericXXX templates 2014-06-27 15:18:36 -04:00
Behdad Esfahbod 36073ede5b Minor: Reorder template parameter order 2014-06-27 15:18:26 -04:00
Behdad Esfahbod 0394ec1bfb Minor: Introduce GenericOffset 2014-06-27 15:18:08 -04:00
Behdad Esfahbod 0d1b3419a7 Minor: Use template parameter default values for OffsetTo 2014-06-27 15:17:47 -04:00
Behdad Esfahbod df554af99d Rename search() to bsearch() and lsearch()
Such that the complexity of the algorithm used is clear at
call site.
2014-06-19 15:39:18 -04:00
Behdad Esfahbod ce34f0b07e [ot-font] Use binary search for format12 cmap subtable 2014-06-04 18:57:46 -04:00
Behdad Esfahbod 51f563579b Move try_set to sanitize context 2014-06-04 18:42:32 -04:00
Behdad Esfahbod b7878cd58e [ot] Implement cmap subtable format 0 2014-05-13 21:47:51 -04:00
Behdad Esfahbod 4719621f20 Minor 2014-05-09 16:09:11 -04:00
Behdad Esfahbod c7074b8798 [otlayout] Add GenericArrayOf::search() 2014-05-08 18:24:31 -04:00
Behdad Esfahbod 40a479797a [otlayout] Add GenericSortedArrayOf 2014-05-08 18:21:04 -04:00
Behdad Esfahbod 6faff8e413 Add static storage classifier to inline functions
Before we were just relying on the compiler inlining them and not
leaving a trace in our public API.  Try to fix.  Hopefully not
breaking anyone's build.
2014-04-28 14:30:44 -07:00
Behdad Esfahbod 6775da3a7c Fix clang warning 'private field 'xxx' is not used
Fixes https://github.com/behdad/harfbuzz/pull/16
2014-01-23 14:18:49 -05:00
Behdad Esfahbod 2a8c49ade0 Remove unnecessary includes 2013-12-11 20:24:20 -05:00
Behdad Esfahbod 05bad3b8c2 [uniscribe] Use OT::* types 2013-07-21 17:19:09 -04:00
Behdad Esfahbod 8659c63608 Hand-code bsearch in the hot inner loop.
Saves another 3 / 4 percent with Amiri.
2013-04-19 14:36:32 -04:00
Behdad Esfahbod 9c5a9ee967 [OTLayout] Rename process() to dispatch() 2013-03-09 01:55:04 -05:00
Behdad Esfahbod 05d5d3cd63 Fix "comparison between signed and unsigned" warnings
Patch from Jonathan Kew.
2013-02-25 23:57:51 -05:00
Behdad Esfahbod 07a52b6211 Give up sanitizing after 100 edit requests
Such fonts are *definitely* really broken.  Give up.
Limits time spent in sanitize for extremely / deliberately broken
fonts.  For example, two fonts with these md5sum / names:

  9343f0a1b8c84b8123e7d201cae62ffd.ttf
  eb8c978547f09d368fc204194fb34688.ttf

were spending over a second in sanitize!  Not anymore.
2013-02-25 19:09:57 -05:00
Behdad Esfahbod 27589620ba [OTLayout] Remove unused code 2013-02-15 11:47:09 -05:00
Behdad Esfahbod e95e031b56 [GPOS] If an Anchor offset is NULL, return false
If in a MarkPos table, a base has no anchor for a particular mark class,
return NULL such that the subsequent subtables get a chance at it.

Test case:
hb-shape ./EBGaramond12-Regular.otf ἂ --features="ss20","smcp"
2013-01-08 16:17:06 -06:00
Behdad Esfahbod e77b442574 [OTLayout] Fix tracing 2012-12-17 18:42:59 -05:00
Behdad Esfahbod 9b54562d63 [OTLayout] Towards correct FeatureParams handling 2012-12-17 13:55:36 -05:00
Behdad Esfahbod bd61bc13ea [OTLayout] Add UINT24 type 2012-12-11 16:01:07 -05:00
Behdad Esfahbod 0beb66e3a6 Fix warnings 2012-12-05 19:14:28 -05:00
Behdad Esfahbod 2c53bd3c3e [OTLayout] Start porting sanitize() to process() 2012-11-23 17:29:05 -05:00
Behdad Esfahbod be218c688c Pass this object to trace macros 2012-11-23 15:32:14 -05:00
Behdad Esfahbod 902cc8aca0 [OTLayout] Start unbreaking tracing 2012-11-23 15:23:30 -05:00
Behdad Esfahbod dabe698fcb Minor 2012-11-23 14:21:35 -05:00
Behdad Esfahbod 81822528ef Minor 2012-11-23 13:27:16 -05:00
Behdad Esfahbod 7d52e6601f Whitespace 2012-11-16 18:49:54 -08:00
Behdad Esfahbod fd0de881f4 Avoid C++ undefined behavior
https://bugzilla.mozilla.org/show_bug.cgi?id=810823
2012-11-15 10:48:50 -08:00
Behdad Esfahbod 811eefe225 Return NULL, not false
Oh well...
2012-09-10 09:56:27 -04:00
Behdad Esfahbod fabd3113a9 [OT] Port Arabic fallback shaping to synthetic GSUB
All of init/medi/fina/isol and rlig implemented.

Let there be dragons... ⻯
2012-09-06 00:51:44 -04:00
Behdad Esfahbod 715e03bc21 Minor 2012-09-04 20:10:17 -04:00
Behdad Esfahbod a930c68e9c [OT] More serialize. Implements all basic GSUB subtables 2012-09-04 19:16:09 -04:00
Behdad Esfahbod 1f07e3382a [OT] Implement serialize() for MultiSubst 2012-09-03 23:28:34 -04:00
Behdad Esfahbod 4912030dfb Minor 2012-09-03 21:00:48 -04:00
Behdad Esfahbod 4b312fb288 [OT] Remove serialize alignment
Will reintroduce in a different way when we actually need it.
2012-09-01 21:56:06 -04:00
Behdad Esfahbod c61be03d6d [OT] A bit more serialize 2012-09-01 21:49:44 -04:00
Behdad Esfahbod abcc5ac1fd [OT] Improve serialize syntax
For some definition of improvement...
2012-09-01 21:30:17 -04:00
Behdad Esfahbod bc5be24014 [OT] Restart work on serialize() 2012-09-01 21:25:20 -04:00
Behdad Esfahbod 9f2348de58 [OT] Add serialize() for Coverage 2012-08-29 21:08:59 -04:00
Behdad Esfahbod e901b954c6 [OT] Start adding serialize() API 2012-08-29 20:26:08 -04:00
Behdad Esfahbod 7c8e844d92 Use namespace for OpenType tables
Avoids USHORT, SHORT, ULONG, LONG clashes with Windows API.
2012-08-28 17:57:49 -04:00
Behdad Esfahbod 70416de298 Minor 2012-06-09 00:56:41 -04:00
Behdad Esfahbod 99159e52a3 Use linear search for small counts
I see about 8% speedup with long strings with DejaVu Sans.
2012-06-09 00:50:40 -04:00
Behdad Esfahbod 0bb0f5d419 Add note re _NullPool 2012-06-07 17:42:48 -04:00
Behdad Esfahbod a00a63b5ef Add macros to check that types are POD 2012-06-06 03:07:01 -04:00
Behdad Esfahbod cf26e88a5a Finish off debug output beautification 2012-05-11 03:16:57 +02:00
Behdad Esfahbod 0ab8c86217 Annotate SANITIZE return values
More to come, for APPLY, CLOSURE, etc.
2012-05-11 02:11:52 +02:00
Behdad Esfahbod 1e08830b4f Beautify debug output 2012-05-11 00:43:57 +02:00
Behdad Esfahbod 6f45538017 More massaging trace messaging 2012-05-10 23:24:43 +02:00
Behdad Esfahbod 208109703c Better trace message support infrastructure
We have varargs in the trace interface now.  To be used soon...
2012-05-10 23:06:58 +02:00
Behdad Esfahbod ae9877dea6 Add hhea-table support 2011-08-17 15:00:10 +02:00
Behdad Esfahbod d7bf473ef2 Minor 2011-08-05 19:59:02 -04:00
Behdad Esfahbod c605bbbb6d Remove C++ guards from source files
Where causing issues for people with MSVC.
2011-08-04 20:00:53 -04:00
Behdad Esfahbod f60271c0c2 Add mingw32 support
With these changes, on Ubuntu I can do:

./configure --host=i586-mingw32msvc  && make
2011-08-02 10:00:55 -04:00
Behdad Esfahbod cc06c243d8 Streamline debugging infrastructure even more 2011-07-25 20:34:17 -04:00
Behdad Esfahbod 43ff203d8e Use variadic macros for debugging
Looks *so* much nicer!
2011-07-25 17:35:24 -04:00
Behdad Esfahbod decd4e3e16 Add sugar syntax for debug messages
Buffer debugging coming soon.
2011-07-25 16:47:02 -04:00
Behdad Esfahbod 31f18abecb Minor compiler warning fixes 2011-06-15 09:49:58 -04:00
Behdad Esfahbod b9452bfc16 Fix compiler warnings with -pedantic 2011-06-14 14:47:07 -04:00
Behdad Esfahbod 4f28fbdd80 Fix TTC header handling
Also change the Version type to avoid similar bugs in the future.

Reported by Grigori Goronzy.
2011-05-31 12:33:11 -04:00
Behdad Esfahbod 4101ca7dbb Plug more leaks
All good now.
2011-05-11 14:30:56 -04:00