Commit Graph

4475 Commits

Author SHA1 Message Date
Werner Lemberg bd9400bd46 [truetype] Integer overflow issues.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7453

* src/truetype/ttinterp.c (Round_Super, Round_Super_45): Use
ADD_LONG and SUB_LONG.
2018-04-09 21:28:37 +02:00
Werner Lemberg 3b8f16803c [cff, type1] Sanitize `BlueFuzz' and `BlueShift'.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7371

* src/cff/cffload.c (cff_load_private_dict): Sanitize
`priv->blue_shift' and `priv->blue_fuzz' to avoid overflows later
on.

* src/type1/t1load.c (T1_Open_Face): Ditto.
2018-04-04 20:26:08 +02:00
suzuki toshiya 26ad1acbcb * src/truetype/ttobjs.c (trick_names): Add 3 tricky fonts (#53554),
`DFHei-Md-HK-BF', `DFKaiShu-Md-HK-BF' and `DFMing-Bd-HK-BF'.
(tt_check_trickyness_sfnt_ids): Add checksums for 3 tricky fonts
in above.
2018-04-04 16:39:42 +09:00
Werner Lemberg 597cb3b442 [truetype] Fix memory leak (only if tracing is on).
* src/truetype/ttgxvar.c (TT_Get_MM_Var) [FT_DEBUG_LEVEL_TRACE}: Fix
it.
2018-03-30 13:46:03 +02:00
Ben Wagner 34e467332b [sfnt] Correctly handle missing bitmaps in sbix format (#53404).
* src/sfnt/ttfsbit.c (tt_face_load_sbix_image): Fix return value.
2018-03-23 06:13:25 +01:00
Ben Wagner 43d4852ec6 [truetype] Fix advance of empty glyphs in bitmap fonts (#53393).
* src/truetype/ttgload.c (TT_Load_Glyph): Apply scaling to metrics
for empty bitmaps.
2018-03-23 06:07:24 +01:00
Werner Lemberg 5bd76524ef * src/sfnt/ttcmap.c (tt_cmap2_validate): Fix potential numeric
overflow.
2018-03-13 11:11:16 +01:00
Werner Lemberg 78cded2c5c Fix cmap format 2 handling (#53320).
The patch introduced for #52646 was not correct.

* src/sfnt/ttcmap.c (tt_cmap2_char_next): Adjust condition.
2018-03-13 11:09:44 +01:00
Werner Lemberg 733a21bdbc Make `ftlcdfil.c' part of the `base' module.
`ftobjs.c' needs `ft_lcd_padding'.

Problem reported by duhuanpeng <548708880@qq.com>.

* modules.cfg (BASE_EXTENSIONS): Don't include `ftlcdfil.c'.

* src/base/ftbase.c: Include `ftlcdfil.c'.
* src/base/rules.mk (BASE_SRC): Add `ftlcdfil.c'.
* src/base/Jamfile (_sources): Adjusted.

* docs/INSTALL.ANY: Updated.
2018-03-05 23:37:17 +01:00
Werner Lemberg f4a3531655 Make `ftfntfmt.c' part of the `base' module.
`ftobjs.c' needs `FT_Get_Font_Format'.

Problem reported by duhuanpeng <548708880@qq.com>.

* modules.cfg (BASE_EXTENSIONS): Don't include `ftfntfmt.c'.

* src/base/ftbase.c: Include `ftfntfmt.c'.
* src/base/rules.mk (BASE_SRC): Add `ftfntfmt.c'.
* src/base/Jamfile (_sources): Adjusted.

* docs/INSTALL.ANY: Updated.
2018-03-05 20:45:12 +01:00
Werner Lemberg efd13c5d1b * src/truetype/ttinterp.c (TT_RunIns): Fix tracing arguments. 2018-03-01 22:17:54 +01:00
Werner Lemberg 713d68ee9f [sfnt] Prefer `CBDT'/`CBLC' over `glyf' table (#53154). 2018-02-17 18:35:15 +01:00
Werner Lemberg 63aaf89cec s/sub-pixel/subpixel/. 2018-02-17 10:34:47 +01:00
Werner Lemberg 4a03f17449 [truetype] Integer overflow issues.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6027

* src/truetype/ttinterp.c (Ins_MSIRP, Ins_MIAP, Ins_MIRP): Use
SUB_LONG; avoid FT_ABS.
2018-02-06 02:23:19 +01:00
Werner Lemberg 036bdc0c9a [truetype] Minor typo. 2018-01-28 00:05:46 +01:00
Werner Lemberg 68dddcdcbe [truetype] Better protection against invalid VF data.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5739

Bug introduced in commit 08cd62deed.

* src/truetype/ttgxvar.c (TT_Set_Var_Design): Always initialize
`normalizedcoords'.
2018-01-27 23:59:30 +01:00
Werner Lemberg 29c759284e * src/truetype/ttinterp.c (Ins_GETVARIATION): Avoid NULL reference.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5736
2018-01-27 14:43:43 +01:00
Werner Lemberg f438e06972 * src/truetype/ttgxvar.c (tt_set_mm_blend): Minor. 2018-01-27 14:39:15 +01:00
Werner Lemberg ef48653023 [truetype] Better trace VF instances.
* src/truetype/ttgxvar.c (ft_var_to_normalized): Don't emit number
of coordinates.
(TT_Get_MM_Var): Trace instance indices names.
(TT_Set_Var_Design): Updated.
2018-01-27 13:58:02 +01:00
Werner Lemberg 5f94c90f19 Fix comment. 2018-01-27 10:52:13 +01:00
Werner Lemberg 50f693a78b [truetype] Beautify tracing of VF axis records.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Show axis records in a
table-like manner.
2018-01-27 10:15:58 +01:00
Werner Lemberg 994eb2b349 [truetype] Fix multiple calls of `FT_Get_MM_Var' (#52955).
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Set
`face->blend->num_axis' in case we have to initialize the
`face->blend'.
2018-01-26 23:17:43 +01:00
Alexei Podtelezhnikov b1e0209829 [apinames] Anonymous version map for GNU linker.
* src/tools/apinames.c (PROGRAM_VERSION): Set to 0.3.
(OutputFormat): Add `OUTPUT_GNU_VERMAP'.
(names_dump): Handle it.
(usage): Updated.
(main): Handle new command line flag `-wL'.
2018-01-23 22:29:45 -05:00
Alexei Podtelezhnikov 6ce6685659 * src/base/ftver.rc: Fix mingw-w64 compilation. 2018-01-18 21:29:48 -05:00
Alexei Podtelezhnikov 4b8ccc56d8 [build] Enable VERSIONINFO resource for Cygwin/MinGW.
* builds/unix/configure.raw: Check for resource compiler.
* builds/unix/unix-cc.in: Conditionally set up resource compiler.
* builds/freetype.mk: Add conditional rule for `ftver.rc'.
* src/base/ftver.rc: Copyright notice and year update.
2018-01-18 04:32:52 -05:00
Alexei Podtelezhnikov fd8000f040 [build] Move VERSIONINFO resource.
* builds/windows/vc2010/freetype.vcxproj: Updated.
* builds/windows/ftver.rc: Move file from here...
* src/base/ftver.rc: ... to here.
2018-01-18 03:58:34 -05:00
Ewald Hew cc2f3cdecf [psaux] Correctly handle Flex features (#52846).
* src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_cmdVMOVETO,
cf2_cmdHMOVETO>: Do not move if doing Flex.
2018-01-10 13:28:36 +08:00
Ewald Hew 21bd9c2f8c [psaux] Fix Type 1 glyphs with too many stem hints.
According to the CFF specification, charstrings can have up to 96 stem
hints. Due to hint replacement routines in Type 1 charstrings, some
glyphs are rejected by the Adobe engine, which implements the above
limit. This fix turns off hinting for such glyphs.

* src/psaux/pshints.c (cf2_hintmap_build): Reset the error from calling
`cf2_hintmask_setAll' on a problematic Type 1 charstring and turn off
hinting.
2018-01-07 16:38:54 +08:00
Werner Lemberg 3758aed760 Add `FT_Done_MM_Var'.
This is necessary in case the application's memory routines differ
from FreeType.  A typical example is a Python application on Windows
that calls FreeType compiled as a DLL via the `ctypes' interface.

* include/freetype/ftmm.h, src/base/ftmm.c (FT_Done_MM_Var): Declare
and define.

* docs/CHANGES: Updated.
2018-01-06 08:39:36 +01:00
Werner Lemberg 029c9b2391 [truetype] Round offsets of glyph components only if hinting is on.
* src/truetype/ttgload.c (TT_Process_Composite_Component): Implement
it.
2018-01-03 19:05:20 +01:00
Werner Lemberg 55d6abea5d * src/truetype/ttgxvar.c (ft_var_to_design): Remove dead code.
This is a better fix than the previous commit, which is now
reverted.
2018-01-03 19:01:15 +01:00
Werner Lemberg ecfdfd4498 [truetype] Make blend/design coordinate round-tripping work.
Behdad reported that setting blend coordinates, then getting design
coordinates did incorrectly return the default instance's
coordinates.

* src/truetype/ttgxvar.c (tt_set_mm_blend): Fix it.
2018-01-03 00:20:11 +01:00
Werner Lemberg 0a0c22569d Update copyright year. 2018-01-02 09:33:57 +01:00
Werner Lemberg 3f090c6843 * src/sfnt/ttcmap.c (tt_cmap2_char_next): Fix endless loop.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4838
2017-12-31 10:32:08 +01:00
Werner Lemberg 14cd073437 Fix compiler warnings.
* src/base/ftbitmap.c (ft_bitmap_assure_buffer): Make `pitch' and
`new_pitch' unsigned.

* src/base/ftpsprop.c: Include FT_INTERNAL_POSTSCRIPT_PROPS_H.
2017-12-27 08:59:46 +01:00
Werner Lemberg 3cc88e2e44 Fixes for `make multi'.
* include/freetype/internal/ftpsprop.h: Use `FT_BASE_CALLBACK'.
(ps_property_get): Harmonize declaration with corresponding
function typedef.

* include/freety[e/internal/fttrace.h: Add `trace_psprops'.

* src/base/ftpsprop.c: Include necessary header files.
(FT_COMPONENT): Define.
(ps_property_set): Tag with `FT_BASE_CALLBACK_DEF'.
(ps_property_get): Tag with `FT_BASE_CALLBACK_DEF'.
Harmonize declaration with corresponding function typedef.
2017-12-27 08:19:09 +01:00
Werner Lemberg dd6330d74b Add missing ChangeLog entry, copyright notices, whitespace, formatting. 2017-12-27 08:06:47 +01:00
Ewald Hew a956e36c8d Move PostScript drivers' property handlers to `base'
This reduces the amount of duplicated code across PostScript drivers.

* src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c
({cff,cid,t1}_property_{get,set}): Moved to...
* include/freetype/internal/ftpsprop.h: ...this new file.
(ps_property_{get,set}): New functions to replace moved ones.
* src/base/ftpsprop.c: Implement above functions.

* include/freetype/internal/internal.h (FT_INTERNAL_POSTSCRIPT_PROPS_H):
New macro.
* src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c: Updated.

* src/base/Jamfile, src/base/rules.mk, src/base/ftbase.c: Updated.
2017-12-25 12:53:21 +08:00
Werner Lemberg 08cd62deed Speed up FT_Set_Var_{Design,Blend}_Coordinates if curr == new.
We exit early if the current design or blend coordinates are
identical to the new ones.

* src/truetype/ttgxvar.c (tt_set_mm_blend, TT_Set_Var_Design):
Implement it, returning internal error code -1 if there will be no
variation change.

* src/type1/t1load.c (t1_set_mm_blend): Ditto.

* src/base/ftmm.c (FT_Set_Var_Design_Coordinates,
FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Updated.
2017-12-20 22:06:19 +01:00
Werner Lemberg 0579d545af Update incorrect ChangeLog entry. 2017-12-18 23:45:58 +01:00
Werner Lemberg 2df73b397d [sfnt] Fix charmap type 2 iterator (#52646).
The subsetted demo font of the report that exhibits the bug has a
very unusual type 2 cmap for Unicode(!): It contains only two
sub-headers, one for one-byte characters (covering the range 0x20 to
0xFA), and a second one for higher byte 0x01 (just for character
code U+0131).

Before this commit, the iterator wasn't able to correctly handle a
sub-header for higher byte 0x01.

* src/sfnt/ttcmap.c (tt_cmap2_char_next): Fix character increment
for outer loop.
2017-12-18 23:32:32 +01:00
Matthias Clasen bdab6578af [truetype] Minor code beautification.
* src/truetype/ttgxvar.c (ft_var_to_normalized): Trace number of
design coordinates.
Simplify code.
2017-12-18 20:45:17 +01:00
Werner Lemberg 068a7a03aa * src/*/*: Only use `ft_' and `FT_' variants of stdc library stuff. 2017-12-18 20:34:05 +01:00
Werner Lemberg 2fe272aca6 * src/truetype/ttgxvar.c (tt_face_vary_cvt): Add size guard (#52688). 2017-12-18 19:43:18 +01:00
Werner Lemberg d062c54ce7 [truetype] Fix previous commit.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Correctly handle
unhinted phantom points, which must be properly scaled.
2017-12-18 09:41:17 +01:00
Werner Lemberg e7935f2910 [truetype] Don't apply HVAR and VVAR deltas twice (#52683).
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Always adjust
`pp1' to `pp4', except if we have an HVAR and/or VVAR table.

* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Handle
alternative code branch identically w.r.t. presence of an HVAR
and/or VVAR table.
2017-12-18 07:29:57 +01:00
Jonathan Kew 361af72eea [truetype] Correctly handle variation font phantom points (#52683).
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix phantom
point indices.
2017-12-18 07:28:31 +01:00
Jonathan Kew 7d3dfcd4a5 Fix incorrect advance width scaling (#52683).
* src/base/ftadvance.c (FT_Get_Advances): Always respect the
FT_LOAD_NO_SCALE flag if present.
2017-12-17 08:19:51 +01:00
Werner Lemberg 2c048a8a62 Fix compiler warning (#52640).
* src/base/ftbitmap.c (ft_bitmap_assure_buffer): Remove unused
variable.
2017-12-11 19:24:30 +01:00
Werner Lemberg ea68f1c8d3 [docmaker] Fix code section parsing.
Stuff like

  {
    <bla>
  }

confused the parser, which incorrectly treated `<bla>' as a markup
tag.

* src/tools/docmaker/content.py (ContentProcessor::process_content):
Apply `re_markup_tags' only outside of code sections.
2017-12-08 20:15:15 +01:00