Commit Graph

6462 Commits

Author SHA1 Message Date
Behdad Esfahbod 1b6d0c44b3 [subset] Sketch GDEF subsetting 2018-12-13 18:10:48 -05:00
Behdad Esfahbod 705e2f5056 [subset] Implement for ClassDef 2018-12-13 17:48:42 -05:00
Behdad Esfahbod 6e33a3955d Minor 2018-12-13 16:40:01 -05:00
Behdad Esfahbod cc65901ca7 [serialize] Implement for ClassDef 2018-12-13 16:01:45 -05:00
Behdad Esfahbod e5309e4fd8 [serialize] Implement for ClassDefFormat2 2018-12-13 15:57:12 -05:00
Behdad Esfahbod c8b43cbe31 [serialize] Implement for ClassDefFormat1 2018-12-13 15:53:00 -05:00
Behdad Esfahbod 5761031329 [subset] Minor 2018-12-12 21:21:26 -05:00
Michiharu Ariza 798e98c47b [CFF] bad offset in Index (#1476)
* Update hb-ot-cff-common.hh

* fix bug

* bummer fix wasn't hit. refix

* additional sanity check

* Added test cases for oss-fuzz issues 11805, 11806
2018-12-12 21:08:15 -05:00
Michiharu Ariza bcb4ecaf68 [CFF] check out of range FD index (#1477)
* add fd index checks to subr subsetter

also added oss-fuzz test case

* undid SubrSubsetParam::is_valid

because already validated by SubrClosures.valid
2018-12-12 20:36:01 -05:00
Behdad Esfahbod 2cc993e035 [dispatch] Minor 2018-12-12 10:07:38 -05:00
Behdad Esfahbod 602fbfe3c9 [sanitize] Fix sanitizing sublookup array 2018-12-12 09:56:47 -05:00
Behdad Esfahbod c78e4784fb [dispatch] Minor 2018-12-12 09:50:18 -05:00
Behdad Esfahbod f9d211af1d Revert "Minor fix re sanitize of Lookup subtables"
This reverts commit 7146718bef.

Fixing differently.
2018-12-12 09:44:30 -05:00
Ebrahim Byagowi 7ee5c52345
minor style fix, use void in methods on no argument 2018-12-12 15:14:37 +03:30
Behdad Esfahbod 7146718bef Minor fix re sanitize of Lookup subtables
We were dereferencing Null pointers and trying to sanitize them,
which is not necessary...
2018-12-11 23:44:29 -05:00
Behdad Esfahbod ce069d1932 Minor 2018-12-11 23:07:48 -05:00
Behdad Esfahbod 1aea869446 [subset] Map glyphs during SingleSubst subsetting
Ha!
2018-12-11 22:53:58 -05:00
Behdad Esfahbod 41d1a1c10f [subset] Minor 2018-12-11 22:48:27 -05:00
Behdad Esfahbod 2aba2c6c73 [serialize] Break down assert 2018-12-11 21:21:13 -05:00
Michiharu Ariza 2941208f1e [CFF] oss-fuzz issue 11690 ASSERT: substr.offset >= opStart (#1461)
* fix oss-fuzz 11690: substr.offset >= opStart

detect recursive subroutine call & handle as error

* fix build failure

* add minimized test case for oss-fuzz 11690

* removed asserts
2018-12-11 15:21:24 -05:00
Michiharu Ariza 333586245c minimize use of assert: removed or changed to error handling (#1467) 2018-12-11 15:20:20 -05:00
👻 9f3a51ddb9 [ucdn] Fix header
Fixes https://github.com/harfbuzz/harfbuzz/issues/1470
2018-12-11 13:38:05 -05:00
Ebrahim Byagowi 1683bb2c93
[glyf] minor 2018-12-08 13:57:39 +03:30
Ebrahim Byagowi f7cfe99815
[os2] Move typometrics detection logic to the table (#1465) 2018-12-08 13:40:44 +03:30
Ebrahim Byagowi 47cf9a9633
Apply non-controversial parts of ot-style (#1464)
Things to be used in https://github.com/harfbuzz/harfbuzz/pull/1459
2018-12-08 10:20:25 +03:30
Michiharu Ariza 4d809696ef fix for issue #1447 (#1462)
Added case for OpCode_BaseFontName. This opcode in spec but practically unused.
Added a comment for default case which can't be hit
2018-12-07 20:49:39 -08:00
Ebrahim Byagowi 1abd4fcaec
[fdsc] minor 2018-12-07 22:34:12 +03:30
Michiharu Ariza 59345cdef3 [CFF] Refix oss-fuzz 11714: set_blends (PR #1458) (#1460)
* pass subarray of stack to set_blends

* get_subarray to return a value, not ref

* restored error check (with tweak)
2018-12-06 13:36:26 -08:00
Behdad Esfahbod 20245f0000 Fix likely check
Ouch!
2018-12-06 10:27:37 -08:00
Behdad Esfahbod d866e905fd Add default value to first argument of sub_array() 2018-12-06 10:26:32 -08:00
Behdad Esfahbod f1352f7486 Add sub_array to hb_vector_t 2018-12-06 10:21:17 -08:00
Behdad Esfahbod ca23b71935 Add default-value for second arg of sub_array() 2018-12-06 10:21:17 -08:00
Michiharu Ariza 1ccbdcf73b Merge branch 'master' into cff-check-blends 2018-12-05 21:37:38 -08:00
Michiharu Ariza 14d29a1043 check number of blends against args on stack 2018-12-05 21:33:29 -08:00
Ebrahim Byagowi f95324a335
Merge pull request #1457 from harfbuzz/cff-varstore-sanitize
[CFF] oss-fuzz issue 11713 (CFF2VariationStore::serialize)
2018-12-06 08:33:44 +03:30
Michiharu Ariza c31092ab34 sanitize variationStore in CFF2 against its size 2018-12-05 17:04:55 -08:00
Michiharu Ariza 34e3ef8ff3 Merge branch 'master' into cff-subr-sanitize 2018-12-05 15:50:05 -08:00
Behdad Esfahbod d9dabc00e9
Merge pull request #1454 from harfbuzz/cff-fixbcd
[CFF] fix oss-fuzz issue 11674: parse_bcd
2018-12-05 15:39:34 -08:00
Michiharu Ariza 6dcfda92c1 sanitize CFF1 & CFF2 global subrs 2018-12-05 15:07:46 -08:00
Michiharu Ariza 6708c5595f fix oss-fuzz issue 11675 (ASSERT: count <= str.len)
Also added an additional error check to avail ()
2018-12-05 12:51:18 -08:00
Michiharu Ariza 2cb9d4c183 Merge branch 'master' into cff-fixbcd 2018-12-05 11:25:29 -08:00
Michiharu Ariza a5fa843c74 fixed a bug with fractional part in a negative value 2018-12-05 11:18:16 -08:00
Ebrahim Byagowi 8394a6cb25
[os2] Make newer table fields accessible (#1452) 2018-12-05 15:23:41 +03:30
Ebrahim Byagowi 5ab086ebb1 [fdsc] Implement the table parsing
Related to https://github.com/harfbuzz/harfbuzz/issues/1337

May used in addition to an API related to STAT.

Lots of Apple fonts have it.
2018-12-05 14:48:31 +03:30
Ebrahim Byagowi 8f80e53341 [gasp] Implement the table parsing
May or may not be used in https://github.com/harfbuzz/harfbuzz/pull/1432
2018-12-05 14:48:31 +03:30
Ebrahim Byagowi 79e7e3445e
Merge pull request #1449 from harfbuzz/cff-fixcharset
[CFF] fix for oss-fuzz 11657: Charset overrun
2018-12-05 13:25:18 +03:30
Ebrahim Byagowi cf4b7db6b1
Merge pull request #1448 from harfbuzz/cff-leak
[CFF] fix leak: oss-fuzz 11662
2018-12-05 13:23:23 +03:30
Michiharu Ariza 620d1ef588 fix unsigned long const 2018-12-05 00:36:11 -08:00
Michiharu Ariza 28dfb4c142 fix signed/unsigned comparison 2018-12-05 00:26:03 -08:00
Michiharu Ariza f9cee08edd use sized int types in parse_bcd 2018-12-04 23:58:26 -08:00
Michiharu Ariza c01a5f32a3 refix 2018-12-04 23:23:23 -08:00
Michiharu Ariza 755fefc921 fix bug 2018-12-04 23:18:28 -08:00
Michiharu Ariza 0e81b153af fix typo 2018-12-04 22:40:07 -08:00
Michiharu Ariza 85d4b15cd8 include float.h 2018-12-04 22:30:33 -08:00
Michiharu Ariza 5a7c371e4c check overflow & clamp 2018-12-04 22:24:38 -08:00
Michiharu Ariza 32cc46c75a [CFF] fix oss-fuzz issue 11670: NULL dereference (#1450)
* guard against no subr access

* code tweak

* add minimized testcase for oss-fuzz 11670 (Null deference)
2018-12-05 09:02:34 +03:30
Michiharu Ariza d3d2f32c6e fix oss-fuzz 11657: buffer overrun
Check overrun in Charset1_2::get_glyph
2018-12-04 13:51:26 -08:00
Ebrahim Byagowi d0a250a7b1
Reuse hb_aat_layout_has_* logic in coretext-aat detection logic (#1442) 2018-12-04 23:42:13 +03:30
Michiharu Ariza 803d2f92dc Merge branch 'master' into cff-leak 2018-12-04 11:01:26 -08:00
Michiharu Ariza 6ce8d10b45 add unlikely to error handling 2018-12-04 10:39:17 -08:00
Michiharu Ariza 0b952e6026 more leak fixes 2018-12-04 10:22:35 -08:00
Michiharu Ariza 9473463f5c fix attempt for oss-fuzz 11662 leak 2018-12-04 09:58:48 -08:00
Michiharu Ariza 04f2ca9421 removed assert 2018-12-04 09:24:07 -08:00
Behdad Esfahbod c968869f21
Merge pull request #1441 from harfbuzz/cff-doublenum
use double as CFF Number implementation
2018-12-04 04:14:13 -05:00
Michiharu Ariza c48f53d309 more double changes 2018-12-03 16:59:41 -08:00
Michiharu Ariza 5fff6ab002 additional precision made a difference in extents test 2018-12-03 16:06:58 -08:00
Michiharu Ariza 9e5180cd44 more double changes 2018-12-03 15:32:42 -08:00
Michiharu Ariza 9af33d7a2a Number to use double for all types 2018-12-03 14:48:46 -08:00
Ebrahim Byagowi 01f628cf55 [aat] Expose hb_aat_layout_has_tracking API 2018-12-03 22:27:26 +03:30
Behdad Esfahbod d19b1680b5 [aat] Expose a couple APIs
New API:
+hb_aat_layout_has_substitution()
+hb_aat_layout_has_positioning()
2018-12-03 10:41:37 -05:00
Behdad Esfahbod 84efe0438e [aat] Fix division sign fallout
Happened after 11d2f49af8
since now nClasses is unsigned int...
2018-12-02 12:39:14 -05:00
Behdad Esfahbod 2087f5a2a7 Add casts to hb_array_t<> 2018-12-01 20:04:45 -05:00
Behdad Esfahbod 58d4d19947 Simplify build source list 2018-12-01 19:34:18 -05:00
Behdad Esfahbod 11d2f49af8 New approach to change BigEndian casts to be int-sized
Fixes spurious warnings like:
Fixes https://github.com/harfbuzz/harfbuzz/issues/1436
2018-12-01 13:12:21 -05:00
Behdad Esfahbod 50e0273ab1 Change hb_assert_unsigned_t<> to hb_is_signed<> 2018-12-01 13:07:49 -05:00
Behdad Esfahbod c3a8b047aa Revert "Change BigEndian casts to be int-sized"
This reverts commit eb5ddd32bf.

Broke tests, badly.  To be investigated and reenabled.
2018-12-01 00:26:39 -05:00
Behdad Esfahbod be45677ab6 Minor 2018-12-01 00:04:29 -05:00
Behdad Esfahbod eb5ddd32bf Change BigEndian casts to be int-sized
Fixes spurious warnings like:
Fixes https://github.com/harfbuzz/harfbuzz/issues/1436
2018-12-01 00:03:01 -05:00
Behdad Esfahbod e8860fdcaa Fix more warning 2018-11-30 23:38:24 -05:00
Behdad Esfahbod af349ee348 Fix warning 2018-11-30 23:20:50 -05:00
Behdad Esfahbod 825df6dbc7 [CFF] Change spaces to tabs 2018-11-30 23:04:59 -05:00
Behdad Esfahbod 592f39b3c4 [CFF] Whitespace 2018-11-30 22:54:57 -05:00
Behdad Esfahbod a2e8d1d455 Minor 2018-11-30 22:54:20 -05:00
Behdad Esfahbod 5e64e0f532
Merge pull request #1113 from harfbuzz/cff-subset
CFF/CFF2 subsetter
2018-11-30 22:40:54 -05:00
Bruce Mitchener 09096aa89f Use nullptr instead of 0/NULL. (#1435)
* Use nullptr instead of 0/NULL.

* Update test-name-table.cc
2018-11-30 22:22:49 -05:00
Michiharu Ariza d8c6913765 undo 0u 2018-11-30 18:58:14 -08:00
Michiharu Ariza 2c859b3880 Merge branch 'master' into cff-subset 2018-11-30 18:47:34 -08:00
Behdad Esfahbod fb05908213 Revert ugly fixes
Now that we have 6daf45e0, revert cryptic hacks...

This reverts commit abd81ed4f5.
This reverts commit 9c6921c08c.
This reverts commit d39760cabf.
This reverts commit fedd8e6c17.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1374
2018-11-30 20:56:15 -05:00
Behdad Esfahbod dfad19ad5a Make operator [] take signed int
The built-in operator takes signed int.  So, match it, such that
the built-in is never a better or equally-good match to our operator.
Fixes "ambiguous overload" errors from gcc 4.2 and VS 2008.

See https://github.com/harfbuzz/harfbuzz/issues/1374
2018-11-30 20:56:14 -05:00
Michiharu Ariza 9483da145d redo fixes 2018-11-30 16:59:41 -08:00
Michiharu Ariza 291da44823 yet another 2018-11-30 16:50:46 -08:00
Michiharu Ariza b1821b9d09 some more 2018-11-30 16:31:01 -08:00
Michiharu Ariza 9784cff556 fix another pesky gcc error 2018-11-30 16:07:08 -08:00
Michiharu Ariza 23a797b443 silence picky gcc errors 2018-11-30 15:15:31 -08:00
Michiharu Ariza 9ae954f43a Merge branch 'master' into cff-subset 2018-11-30 15:00:52 -08:00
Behdad Esfahbod fedd8e6c17 One more.........
I wonder if there's something better to do about these :(.

In file included from hb-ot-color.cc:31:
hb-ot-color-cpal-table.hh: In member function 'unsigned int OT::CPAL::get_size() const':
hb-ot-color-cpal-table.hh:118: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
2018-11-30 16:50:30 -05:00
Behdad Esfahbod bc5db9b080 One more....
hb-ot-vorg-table.hh:96: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-vector.hh:87: note: candidate 1: const Type& hb_vector_t<Type, PreallocedCount>::operator[](unsigned int) const [with Type = OT::VertOriginMetric, unsigned int PreallocedCount = 8u]
hb-ot-vorg-table.hh:96: note: candidate 2: operator[](const T*, int) <built-in>
2018-11-30 16:04:52 -05:00
Behdad Esfahbod d39760cabf One more...
Sigh.

hb-ot-kern-table.hh: In member function 'int OT::KernSubTableFormat3<KernSubTableHeader>::get_kerning(hb_codepoint_t, hb_codepoint_t) const':
hb-ot-kern-table.hh:59: error: ambiguous overload for 'operator[]' in 'kernValue[kernIndex[i]]'
hb-ot-kern-table.hh:59: note: candidates are: operator[](T*, int) <built-in>
hb-dsalgs.hh:574: note:                 Type& hb_array_t<Type>::operator[](unsigned int) const [with Type = const OT::IntType<short int, 2u>]
2018-11-30 15:55:30 -05:00
Behdad Esfahbod 9c6921c08c More...
hb-ot-layout-gsubgpos.hh:1707: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
...
2018-11-30 15:16:57 -05:00
Behdad Esfahbod f998bb2086 More weird fixes
In file included from hb-ot-name.cc:29:
hb-ot-name-table.hh: In member function 'unsigned int OT::name::get_size() const':
hb-ot-name-table.hh:157: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-open-type.hh:354: note: candidate 1: const Type& OT::UnsizedArrayOf<Type>::operator[](unsigned int) const [with Type = OT::NameRecord]
hb-ot-name-table.hh:157: note: candidate 2: operator[](const T*, int) <built-in>
hb-ot-name-table.hh: In member function 'void OT::name::accelerator_t::init(hb_face_t*)':
hb-ot-name-table.hh:196: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-dsalgs.hh:574: note: candidate 1: Type& hb_array_t<Type>::operator[](unsigned int) const [with Type = const OT::NameRecord]
hb-ot-name-table.hh:196: note: candidate 2: operator[](T*, int) <built-in>
hb-ot-name-table.hh:197: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-dsalgs.hh:574: note: candidate 1: Type& hb_array_t<Type>::operator[](unsigned int) const [with Type = const OT::NameRecord]
hb-ot-name-table.hh:197: note: candidate 2: operator[](T*, int) <built-in>
hb-ot-name-table.hh:198: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-dsalgs.hh:574: note: candidate 1: Type& hb_array_t<Type>::operator[](unsigned int) const [with Type = const OT::NameRecord]
hb-ot-name-table.hh:198: note: candidate 2: operator[](T*, int) <built-in>
make[4]: *** [libharfbuzz_la-hb-ot-name.lo] Error 1
make[3]: *** [all-recursive] Error 1
2018-11-30 12:52:21 -05:00