Log

Author Commit Date CI Message
Alexei Podtelezhnikov 0447df71 2022-02-09T15:04:58 [pshinter] Use unsigned indices. This reduces casting and eliminates some checks. * src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_table_merge, ps_dimension_add_t1stem, ps_hints_t1stem3): Updated. (ps_dimension_add_counter): Updated, unnecessary checks removed.
Alexei Podtelezhnikov ed0e2e76 2022-02-08T16:35:14 [pshinter] Fix mask merging. We forgot to update the number of bits when merging a larger mask into a smaller one. This fix might have rendering effects. * src/pshinter/pshrec.c (ps_mask_table_merge): Inherit the number of bits from a larger mask. There is no need to zero unused bits, already zeroed during allocation. (ps_mask_clear_bit): Removed. (ps_mask_ensure): Minor.
Alexei Podtelezhnikov 7c6b2f20 2022-02-08T14:37:34 [pshinter] Revise the hint table handling. * src/pshinter/pshrec.c (ps_hint_table_ensure): Remove redundant size check; avoid array zeroing because it is fully initialized when used. (ps_hint_table_alloc): Fix off-by-one comparison and remove another zeroing of the array elements.
Werner Lemberg 24db55ec 2022-02-05T09:06:39 Various minor doc fixes.
Alexei Podtelezhnikov a173aead 2022-02-06T08:25:52 [builds/windows] Add SVG to to project files. * builds/windows/vc2010/freetype.vcxproj: Updated. * builds/windows/vc2010/freetype.vcxproj.filters: Updated. * builds/windows/visualc/freetype.vcproj: Updated.
Alexei Podtelezhnikov dd8676b2 2022-02-03T14:32:50 * src/winfonts/winfnt.c (fnt_face_get_dll_font): Trace font resources.
Eric Jing 56d182a7 2022-02-02T18:14:19 [cmake] Fix build on MacOS. * CMakeLists.txt (CMAKE_OSX_ARCHITECTURES): Update value to fix the building of a framework on MacOS. * builds/mac/freetype-Info.plist (CFBundleExecutable): Make identifier lowercase only. Fixes #1127.
Alexei Podtelezhnikov 8e39e42e 2022-02-02T11:35:14 [psaux] Revise `PS_Table` handling. The old impleemntation was not using `FT_REALLOC`, buing too careful with the offset rebasing. It shoudl be safe to rely on the base movements. * src/psaux/psobjs.c (reallocate_t1_table, shift_elements): Combine into... (ps_table_realloc): ... this function based on `FT_REALLOC`. (ps_table_done): Simplified. (ps_table_add): Updated.
Alexei Podtelezhnikov c6dd509b 2022-02-02T11:32:58 * src/cache/ftcmru.c (FTC_MruList_New): Explain zeroing.
Alexei Podtelezhnikov 946e1353 2022-01-31T14:19:07 [cache] Partially revert 9870b6c07e2c. Fix crashes reported by Werner. * src/cache/ftcmru.c (FTC_MruList_New): Use `FT_ALLOC` again.
Werner Lemberg 36ee3160 2022-01-31T10:37:56 freetype.h: Minor documentation improvement.
Alexei Podtelezhnikov 983d4358 2022-01-30T22:13:51 [cache] Fix fallouts from edd4fedc5427. Reported by Werner. * src/cache/ftcimage.c (FTC_INode_New): Always initialize FT_Glyph. * src/cache/ftcsbits.c (FTC_SNode_New): Always initialize FT_SBit.
Alexei Podtelezhnikov bee88864 2022-01-30T21:55:21 Clean-up - do not doubt FT_FREE. * src/base/ftobjs.c (memory_stream_close): Do not reassign zero after `FT_FREE`. * src/sfnt/sfwoff.c (sfnt_stream_close): Ditto. * src/sfnt/sfwoff2.c (stream_close): Ditto. * src/psaux/psobjs.c (ps_parser_load_field): Ditto. * src/truetype/ttgxvar.c (ft_var_load_avar, tt_set_mm_blend, tt_set_mm_blend): Ditto.
Werner Lemberg 7fd03a3e 2022-01-30T20:50:42 * CMakeLists.txt: Include 'FindPkgConfig' module. Older cmake versions don't provide `pkg_check_modules` by default. Fixes #1126.
Alexei Podtelezhnikov da877c86 2022-01-29T22:46:56 * src/psaux/psobjs.c (ps_parser_load_field): Reduce `string` scope.
suzuki toshiya 35740aa6 2022-01-28T12:04:36 [cmake] Check the availability of `bzip2.pc'. (CMakeLists.txt): Check the availability of `bzip2.pc'. * If `bzip2.pc' is available, Requires.private should include bzip2, but Libs.private should not include -lbz2. * If `bzip2.pc' is unavailable, Requires.private cannot include bzip2, but Libs.private should include -lbz2. Fix #897.
Werner Lemberg fa226478 2022-01-28T15:20:12 * unix/configure.raw: We need 'librsvg' version 2.46.0 or newer. Older versions don't have function `rsvg_handle_get_intrinsic_dimensions`.
Alexei Podtelezhnikov b34741c1 2022-01-27T22:55:34 Minor clean-ups. * src/base/ftrfork.c (raccess_make_file_name): Do not set error. * src/sfnt/sfdriver.c (get_win_string, get_apple_string): Ditto. * src/cff/cffobjs.c (cff_strcpy): Do not confuse about error. * src/psaux/psobjs.c (ps_table_done): Ditto. * src/truetype/ttgxvar.c (ft_var_readpacked*, ft_var_load_avar): Ditto.
Ben Wagner e34a860a 2022-01-27T11:50:12 Document `FT_Outline_Decompose` degenerate segments. `FT_Outline_Decompose` does not filter out and can return degenerate segments in an outline. This can be surprising when attemping to stroke such an outline. Clarify the existing documentation on this matter to cover all forms of degeneracy (without specifying exactly how they will be reported), why they might arise, and better explain in what cases they may be an issue. * include/freetype/ftoutlin.h (FT_Outline_Decompose): update documentation. Fixes #952.
Anuj Verma ab1c98ac 2022-01-27T15:23:47 Fix sdf computation while `USE_SQUARED_DISTANCES`. Function `map_fixed_to_sdf` expects spread to be absolute and not squared. * src/sdf/ftbsdf.c (finalize_sdf): Pass absolute spread while `map_fixed_to_sdf`. * src/sdf/ftsdf.c (sdf_generate_bounding_box): Ditto.
Tapish Ojha 3d77756e 2022-01-27T08:34:48 [sfnt] Improve sRGB constants. * src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra): Use slightly more precise values. Fixes #1018.
Werner Lemberg 9476cb7e 2022-01-27T08:32:42 docs/release: Updated.
Alexei Podtelezhnikov 837f0345 2022-01-26T15:49:24 * src/pfr/pfrload.c (pfr_phy_font_load): Use FT_QNEW_ARRAY.
Alexei Podtelezhnikov 0ac53590 2022-01-26T14:02:27 * src/sdf/ftsdf.c (sdf_*_new): Use standard macro.
Alexei Podtelezhnikov 09223ef9 2022-01-26T11:23:38 [pcf] Delay encoding allocation and avoid its zeroing. * src/pcf/pcfread.c (pcf_get_encodings): Refactor and use FT_QNEW_ARRAY.
Werner Lemberg 267c6918 2022-01-25T14:46:36 Aarg, typo.
Werner Lemberg 9af1127f 2022-01-25T14:45:10 freetype.h: More updates to `FT_LOAD_COLOR` description.
Werner Lemberg 8b7226bb 2022-01-25T14:28:45 * builds/unix/configure.raw (FT_DEMO_CFLAGS): Pass `-DHAVE-LIBRSVG`. This helps in decoupling library support from `pkg-config` for other platforms.
Werner Lemberg 6a8e95b7 2022-01-25T08:49:41 Update documentation for `FT_LOAD_COLOR`.
Ben Wagner 5e9caaee 2022-01-24T12:19:20 [pshinter] Ensure all point flags are initialized. Only off curve point flags were fully initialized. * src/pshinter/pshalgo.c (psh_glyph_init): always initialize flags. Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43930
Werner Lemberg 65774521 2022-01-24T07:57:20 .mailmap: Typo.
Werner Lemberg ef48a332 2022-01-23T19:05:15 * src/svg/ftsvg.c (ft_svg_property_set): Disallow NULL pointers.
Werner Lemberg cddfe657 2022-01-23T12:28:21 .mailmap: Updated.
Werner Lemberg 21d0fa37 2022-01-23T12:03:44 More documentation on handling OT-SVG.
Werner Lemberg 9c153852 2022-01-23T08:56:17 * src/svg/ftsvg.c: Rename `svg_hooks` to `svg-hooks` for consistency.
Werner Lemberg 112527dd 2022-01-22T11:45:30 [sfnt] Reject malformed SVG tables. * src/sfnt/ttsvg.c (SVG_TABLE_HEADER_SIZE, SVG_DOCUMENT_RECORD_SIZE, SVG_DOCUMENT_LIST_MINIMUM_SIZE, SVG_MINIMUM_SIZE): New macros. (tt_face_load_svg): Check offsets. Check table and record sizes. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43918
Alexei Podtelezhnikov 706c79a1 2022-01-21T22:46:35 * src/psaux/psobjs.c (ps_table_new): Revert to zeroing.
Alexei Podtelezhnikov 0d2b4952 2022-01-20T14:47:01 [psaux, type1, type42] Avoid annecessary zeroing. * src/psaux/psobjs.c (ps_table_new): Use FT_QNEW_ARRAY. * src/type1/t1load.c (parse_encoding): Ditto. * src/type42/t42parse.c (t42_parse_encoding): Ditto.
Werner Lemberg 02fa26f4 2022-01-03T17:48:36 [builds/unix] Handle 'librsvg' for demo programs. * builds/unix/configure.raw: Check for 'librsvg'. (LIB_CLOCK_GETTIME): Don't call `AC_SUBST` on this but on... (FT_DEMO_CFLAGS, FT_DEMO_LDFLAGS): ... these two new variables. * builds/unix/unix-cc.in (LIB_CLOCK_GETTIME): Replaced by... (FT_DEMO_CFLAGS, FT_DEMO_LDFLAGS): ... these two new variables.
Moazin Khatti 0bf49bd2 2021-12-25T20:14:11 Add 'svg' module for OT-SVG rendering. * CMakeLists.txt (BASE_SRCS): Add svg module file. * meson.build (ft2_public_headers): Add `otsvg.h`. * modules.cfg (RASTER_MODULES): Add `svg` module. * builds/meson/parse_modules_cfg.py: Add svg module. * include/freetype/config/ftmodule.h: Add `ft_svg_renderer_class`. * include/freetype/fterrdef.h: Add `Invalid_SVG_Document` and `Missing_SVG_Hooks` error codes. * include/freetype/internal/fttrace.h: Add tracing for `otsvg`. * include/freetype/internal/svginterface.h: New file. It adds an interface to enable the presetting hook from the `base` module. * include/freetype/otsvg.h (SVG_Lib_Init_Func, SVG_Lib_Free_Func, SVG_Lib_Render_Func, SVG_Lib_Preset_Slot_Func): New hooks for SVG rendering. (SVG_RendererHooks): New structure to access them. * src/base/ftobjs.c: Include `svginterface.h`. (ft_glyphslot_preset_bitmap): Add code for presetting the slot for SVG glyphs. (ft_add_renderer): Updated. * src/svg/*: New files.
Moazin Khatti 97c09a80 2021-12-25T19:55:58 Add `FT_Glyph` support for OT-SVG glyphs. * include/freetype/ftglyph.h (FT_SvgGlyphRec, FT_SvgGlyph): New structure. * src/base/ftglyph.c: Include `otsvg.h`. (ft_svg_glyph_init, ft_svg_glyph_done, ft_svg_glyph_copy, ft_svg_glyph_transform, ft_svg_glyph_prepare): New function. (ft_svg_glyph_class): New class. (FT_New_Glyph, FT_Glyph_To_Bitmap): Updated to handle OT-SVG glyphs. * src/base/ftglyph.h: Updated.
Moazin Khatti 5cf01aa2 2021-12-25T19:46:46 [truetype, cff] Add code to load SVG document. * src/cff/cffgload.c (cff_slot_load): Add code to load SVG doc. * src/truetype/ttgload.c (TT_Load_Glyph): Add code to load SVG doc.
Moazin Khatti f93a897a 2021-12-25T19:20:44 Add code to load OT-SVG glyph documents. * include/freetype/config/ftheader.h (FT_OTSVG_H): New macro. * include/freetype/freetype.h (FT_FACE_FLAG_SVG, FT_HAS_SVG): New macros. (FT_LOAD_SVG_ONLY): New internal macro. * include/freetype/ftimage.h (FT_Glyph_Format): New enumeration value `FT_GLYPH_FORMAT_SVG`. * include/freetype/internal/ftobjs.h (FT_GLYPH_OWN_GZIP_SVG): New macro. * include/freetype/internal/fttrace.h: Add `ttsvg` for `ttsvg.c`. * include/freetype/internal/sfnt.h(load_svg, free_svg, load_svg_doc): New functions. * include/freetype/internal/tttypes.h (TT_FaceRec): Add `svg` for the SVG table. * include/freetype/otsvg.h (FT_SVG_DocumentRec): New structure to hold the SVG document and other necessary information of an OT-SVG glyph in a glyph slot. * include/freetype/tttags.h (TTAG_SVG): New macro. * src/base/ftobjs.c: Include `otsvg.h`. (ft_glyphslot_init): Allocate `FT_SVG_DocumentRec` in `slot->other` if the SVG table exists. (ft_glyphslot_clear): Free it upon clean-up if it is a GZIP compressed glyph. (ft_glyphslot_done): Free the document data if it is a GZIP compressed glyph. (FT_Load_Glyph): Don't auto-hint SVG documents. * src/cache/ftcbasic.c (ftc_basic_family_load_glyph): Add support for FT_GLYPH_FORMAT_SVG. * src/sfnt/rules.mk (SFNT_DRV_SRC): Add `ttsvg.c`. * src/sfnt/sfdriver.c: Include `ttsvg.h`. (sfnt_interface): Add `tt_face_load_svg`, `tt_face_free_svg` and `tt_face_load_svg_doc`. * src/sfnt/sfnt.c: Include `ttsvg.c`. * src/sfnt/sfobjs.c (sfnt_load_face, sfnt_done_face): Add code to load and free data of the the SVG table. * src/sfnt/ttsvg.c: New file, implementing `tt_face_load_svg`, `tt_face_free_svg` and `tt_face_load_svg_doc`. * src/sfnt/ttsvg.h: Declarations of the SVG functions in `ttsvg.c`.
Moazin Khatti 06c1a25e 2021-12-25T17:59:42 Add flag `FT_CONFIG_OPTION_SVG`. This flag is going to be used to conditionally compile support for OT-SVG glyphs. FreeType will do the parsing and rely on external hooks for rendering of OT-SVG glyphs. * devel/ftoption.h, include/freetype/config/ftoption.h (FT_CONFIG_OPTION_SVG): New flag.
Alexei Podtelezhnikov 0b635b1e 2022-01-20T15:06:25 [pshinter] Avoid unnecessary zeroing. * src/pshinter/pshalgo.c (psh_hint_table_init,psh_glyph_init, psh_glyph_interpolate_normal_points): Use FT_QNEW_ARRAY.
Alexei Podtelezhnikov 99a940f8 2022-01-20T15:06:09 * include/freetype/freetype.h: Clarify `FT_Size` life cycle.
Alexei Podtelezhnikov 054782c4 2022-01-19T22:14:06 [base] Undefined scale means no scale. It might be surprising that FreeType does not have default ppem and the size has to be set explicitly or face undefined behavior with undefined variables and errors. This offers an alternative to missing or zero scale by simply setting FT_LOAD_NO_SCALE. Defined behavior is bettr than undefined one. This is alternative to !132 and discussed in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43708 * src/base/ftobjs.c (FT_Load_Glyph): Deal with zero scale. * include/freetype/freetype.h: Document it.
Alexei Podtelezhnikov 773e31c7 2022-01-18T14:05:46 * src/autofit/afglobal.c (af_face_globals_new): Reduce zeroing. Everything in AF_FaceGlobals is initialized except metrics. Those are zeroed here and initialized on demand later.
Alexei Podtelezhnikov d118bf8e 2022-01-15T23:09:53 [bdf,type1] Avoid unnecessary hash zeroing. * src/bdf/bdflib.c (_bdf_parse_start): Use `FT_QALLOC`. * src/type1/t1load.c (parse_subrs): Use `FT_QNEW`.
Ozkan Sezer 3f6497bd 2022-01-15T22:44:28 Add Watcom C/C++ calling. In the unlikely case the source is built with OpenWatcom's -ec? switches to enforce a calling convention, the qsort() compare function must still be set to __watcall. * include/freetype/internal/compiler-macros.h (FT_COMPARE_DEF): Updated.
Ben Wagner 5e227133 2022-01-15T17:08:18 [pshinter] Avoid accessing uninitialized zone. The `normal_top.count` may be 0, implying no `normal_top.zones` exist. The code must not access these (non-existent) `normal_top.zones`. * src/pshinter/pshalgo.c (ps_hints_apply): Do not assume that `normal_top.zones[0]` is initialized. Test `normal_top.count` before using `normal_top.zones[0]`. Do not rescale if there are no `zones`. Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43675
Alexei Podtelezhnikov edd4fedc 2022-01-14T22:53:57 [cache] Avoid unnecessary zeroing. * src/cache/ftccmap.c (ftc_cmap_node_new): Use `FT_QNEW`. * src/cache/ftcimage.c (FTC_INode_New): Ditto. * src/cache/ftcsbits.c (FTC_SNode_New): Ditto.
Ozkan Sezer 11ea89b5 2022-01-14T22:07:44 Add Watcom C/C++ support. * include/freetype/config/integer-types.h: Make sure `long long` is used then available. * include/freetype/internal/ftcalc.h (FT_MSB): Add Watcom C/C++ pragma.
Alexei Podtelezhnikov ba5d661f 2022-01-14T21:54:17 * src/sdf/ftbsdf.c (ED): s/near/prox/. This works around the Watcom C definition of `near` as restricted __near.
Alexei Podtelezhnikov 7f7bf6f0 2022-01-14T20:33:28 * include/freetype/internal/compiler-macros.h [FT_COMPARE_DEF]: Tighten. This works around Watcom C library using __watcall.
Alexei Podtelezhnikov 7eb9a9db 2022-01-14T14:40:11 * src/pshinter/pshglob.c (psh_globals_new): Avoid zeroing. This large allocation is followed by careful initialization. Whatever is missed should be initialized manually.
Alexei Podtelezhnikov 81b81feb 2022-01-14T18:22:23 * src/base/fthash.c (hash_insert): Avoid unnecessary zeroing.
Alexei Podtelezhnikov 904ad212 2022-01-13T23:38:56 * src/bdf/bdflib.c (_bdf_parse_glyphs): Remove redundant assignment.
Alexei Podtelezhnikov ee52b571 2022-01-13T09:45:48 * src/lzw/ftlzw.c (FT_Stream_OpenLZW): Avoid unnecessary zeroing.
Ben Wagner 6ee89519 2022-01-12T15:12:53 [bzip2] Reset bzip stream on any error. According to the bzip documentation it is undefined what will happen if `BZ2_bzDecompress` is called on a `bz_stream` it has previously returned an error against. If `BZ2_bzDecompress` returns anything other than `BZ_OK` the only valid next action is `BZ2_bzDecompressEnd`. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43564 * src/bzip2/ftbzip2.c (FT_BZip2FileRec_): Add `reset` to track the need to reset the stream. (ft_bzip2_file_init): Initialize `reset` to 0. (ft_bzip2_file_reset): Set `reset` to 0 after resetting. (ft_bzip2_file_fill_output): Set `reset` to 1 when `BZ2_bzDecompress` returns anything other than `BZ_OK`.
Werner Lemberg b647dbde 2022-01-12T06:21:52 .gitlab-ci.yml: Minor comment cleanups.
Azamat H. Hackimov ca44a236 2022-01-12T04:26:39 .gitlab-ci.yml: Add steps to `before_script` to ensure recent CA. Fetch current list of valid CAs from Windows Update and manually import them to trusted datastore. This action is required to make downloads work from sites that need recent Let's Encrypt ISRG Root X1 certificate.
Ben Wagner f1d3b9f1 2022-01-11T17:15:35 Revert "[bzip2] Avoid use of uninitialized memory." This reverts commit d276bcb7f0c02c20d3585b2e5626702df6d140a6. The original commit did avoid the use of uninitialized memory. However, it appears that the original commit is no longer required. The underlying issue was resolved by a change in freetype2-testing "Build bzip2 correctly." [0]. Prior to [0] bzip2 was built without msan, so bzip2 writes were not tracked or considered initialized. Clearing `buffer` in the original commit allowed msan to see the `buffer` content initialized once in FreeType code, but msan saw no writes into buffer from bzip2. With bzip2 now built with msan, the bzip2 writes are properly instrumented and msan sees the bzip2 writes into the buffer. As a result the original commit can be safely reverted to allow for better detection of other uninitialized data scenarios. * src/bzip2/ftbzip2.c (FT_Stream_OpenBzip2): Revert to using `FT_QNEW`. [0] https://github.com/freetype/freetype2-testing/commit/3c052a837a3c960709227a0d6ddd256e87b88853
Ben Wagner e838c37c 2022-01-11T11:14:32 [type42] Track how much type42 ttf data is available. Currently `T42_Open_Face` eagerly allocates 12 bytes for the ttf header data which it expects `t42_parse_sfnts` to fill out from /sfnts data. However, there is no guarantee that `t42_parse_sfnts` will actually be called while parsing the type42 data as the /sfnts array may be missing or very short. This is also confusing behavior as it means `T42_Open_Face` is tightly coupled to the implementation of the very distant `t42_parse_sfnts` code which requires at least 12 bytes to already be reserved in `face->ttf_data`. `t42_parse_sfnts` itself eagerly updates `face->ttf_size` to track how much space is reserved for ttf data instead of traking how much data has actually been written into `face->ttf_data`. It will also act strangely in the presense of multiple /sfnts arrays. * src/type42/t42objs.c (T42_Open_Face): ensure `ttf_data` is initialized to NULL. Free `ttf_data` on error. * src/type42/t42parse.c (t42_parse_sfnts): delay setting `ttf_size` and set it to the actual number of bytes read. Ensure `ttf_data` is freed if there are multiple /sfnts arrays or there are any errors.
Dominik Röttsches 3876846e 2022-01-11T13:40:20 [sfnt] Fix limit checks for `COLR` v1 ClipBoxes * src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Fix off-by-one in limit checks.
Werner Lemberg d0cfb4e1 2022-01-11T10:54:10 Update all copyright notices.
Werner Lemberg 947fddc8 2022-01-09T07:26:26 * src/sfnt/ttcolr.c (read_paint): Fix undefined left-shift operation. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43151
Werner Lemberg 639a0215 2022-01-11T09:14:48 * src/type42/t42objs.c (T42_Open_Face): Avoid use of uninitialized memory. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43508
Werner Lemberg 33626164 2022-01-11T08:01:30 .gitlab-ci.yml: Fix typo in previous commit.
Werner Lemberg 4c0db607 2022-01-11T07:52:28 .gitlab-ci.yml: Update Windows image. The old image produced errors like ``` Downloading zlib patch from https://wrapdb.mesonbuild.com/v2/zlib_1.2.11-5/get_patch A fallback URL could be specified using patch_fallback_url key in the wrap file WrapDB connection failed to https://wrapdb.mesonbuild.com/v2/zlib_1.2.11-5/get_patch with error <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1122)> ```
Werner Lemberg 2e62b744 2022-01-11T05:37:56 * subprojects/zlib.wrap: Update from upstream.
Werner Lemberg 4a89112b 2022-01-08T16:56:57 * src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Add limit checks. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40716
Werner Lemberg 3f9b78fc 2022-01-10T18:19:41 [zlib] Don't typedef `ptrdiff_t`. While using zlib in 'solo' mode (via the `Z_SOLO` macro), we actually include some standard header files, making the typedef fail on systems where the native `ptrdiff_t` type differs. Fixes #1124. * src/zlib/zutil.h: Comment out definition; it doesn't work on Windows. * src/zlib/patches/freetype-zlib.diff: Updated.
Werner Lemberg da8a8b8b 2022-01-10T17:25:47 [zlib] Some organizational changes. We now first apply zlib's `zlib2ansi` script, then FreeType's patch file. * src/gzip/README.freetype: Updated. * patches/0001-zlib-Fix-zlib-sources-to-compile-for-FreeType.patch: Renamed to... * patches/freetype-zlib.diff: This. Clean up description, then regenerate it as follows: - Copy unmodified files from `zlib` repository. - Run `zlib2ansi` script. - Run `git diff -R > patches/freetype-zlib.diff.new`. - Insert patch description of old diff file, then replace old diff with new diff file.
David Turner a25e85ed 2021-08-17T15:20:25 [gzip] Update sources to zlib 1.2.11 This can be tested by building with the Unix development build make setup devel make or by building the freetype-demos programs with meson setup build -Dfreetype2:zlib=internal meson compile -C out and trying to run `ftview` with a `.pcf.gz` font file. * src/gzip/ftgzip.c, src/gzip/rules.mk: Update for new zlib sources. Also remove the temporary fix introduced in commit 6a431038 to work around the fact that the internal sources were too old. * src/gzip/README.freetype: New file describing the origin of the sources and how they were modified. * src/gzip/patches/*: Patch files applied to original sources. * src/gzip/*: Updated zlib sources with the patch file(s) from `src/gzip/patches/` applied, followed by a conversion with zlib's `zlib2ansi` script.
David Turner 0d343863 2021-08-17T17:27:36 [meson] Change Zlib configuration option. * meson_options.txt, meson.build: Change the format of the 'zlib' meson build configuration option to be a combo with the following choices: - none: Do not support gzip-compressed streams at all. - internal: Support gzip-compressed streams using the copy of the gzip sources under `src/gzip/`; this should only be used during development to ensure these work properly. - external: Support gzip-compressed streams using the 'zlib' Meson subproject, linked as a static library. - system: Support gzip-compressed streams using a system-installed version of zlib. - auto: Support gzip-compressed streams using a system-installed version of zlib, if available, or using the 'zlib' subproject otherwise. This is the default. - disabled: Backward-compatible alias for 'none'. - enabled: Backward-compatible alias for 'auto'.
Werner Lemberg d276bcb7 2022-01-09T07:48:59 [bzip2] Avoid use of uninitialized memory. * src/bzip2/ftbzip2.c (FT_Stream_OpenBzip2): Don't use `FT_QNEW` but `FT_NEW` for setting up `zip` to avoid uninitialized memory access while handling malformed PCF fonts later on. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=42800
Alexei Podtelezhnikov ca011128 2022-01-08T22:28:44 [sfnt] Fix off-by-one error. The 0-base index is equal to the number of previosly parsed entries. It is an error to adjust it by one to get the number truncated by a stream error. This is probably inconsequential because valid entries are correctly accounted for. * src/sfnt/ttload.c (check_table_dir): Do not adjust the truncated number of tables.
Werner Lemberg 7a493e3a 2022-01-08T10:28:19 [sfnt, type42] Correct previous commit. Really fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=42773. * src/sfnt/ttload.c (check_table_dir): Revert change. * src/type42/t42.parse.c (t42_parse_sfnts): Don't use `FT_QREALLOC` but `FT_REALLOC` for setting up `ttf_data` to avoid uninitialized memory access while handling malformed TrueType fonts later on.
Werner Lemberg bf9b1ef9 2022-01-07T10:25:52 * src/sfnt/ttload.c (check_table_dir): Initialize `table`. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=42773
Werner Lemberg b5c2172f 2022-01-07T06:53:44 [sfnt] Avoid 'runtime error: applying zero offset to null pointer'. * src/sfnt/ttsbit.c (tt_sbit_decoder_load_byte_aligned): Exit early if `line` is NULL.
Werner Lemberg 5aa2a5c3 2022-01-07T06:41:36 [autofit, pshinter] Use `FT_OFFSET`. This avoids ``` runtime error: applying zero offset to null pointer ``` warnings of clang's undefined behaviour sanitizer. * src/autofit/afcjk.c (af_cjk_hints_link_segments, af_cjk_hints_compute_edges, af_cjk_hints_compute_blue_edges, af_cjk_hint_edges, af_cjk_align_edge_points): Do it. * src/autofit/afhints.c (af_glyph_hints_align_edge_points, af_glyph_hints_align_strong_points): Ditto. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_hints_link_segments, af_latin_hints_compute_edges, af_latin_hints_compute_blue_edges, af_latin_hint_edges): Ditto. * src/pshinter/pshalgo.c (psh_hint_table_init): Ditto.
Ben Wagner afb4ca01 2022-01-06T12:54:15 [truetype] Reset localpoints when varying cvt. When iterating over the cvt tuples and reading in the points it is necessary to set all of `localpoints`, `points`, and `point_count` in all cases. The existing code did not reset `localpoints` to `NULL` when there were no private point numbers. If the previous tuple did have private point numbers and set `localpoints` to `ALL_POINTS` this would not be cleared and the wrong branch would be taken later, leading to possible heap buffer overflow. * src/truetype/ttgxvar.c (tt_face_vary_cvt): Reset `localpoints` to `NULL` when it isn't valid. Fixes: https://crbug.com/1284742
Werner Lemberg 2b672e72 2022-01-02T18:33:03 * builds/unix/configure.raw: Restore `SYSTEM_ZLIB` variable. This was accidentally removed with commit 93ebcbd0 almost eight years ago.
Alexander Borsuk 4eb6cb88 2021-12-25T09:23:58 Fix warnings for CMake Unity builds. * src/cache/ftcbasic.c (FT_COMPONENT): Undefine macro before redefinition. * src/smooth/ftgrays.c (TRUNC, FRACT): Ditto.
Alexander Borsuk 4f357118 2021-12-17T11:22:09 Clang-Tidy warning fixes. * src/base/ftobjs.c (FT_Get_Paint): Operator has equivalent nested operands. * src/bdf/bdflib.c (_bdf_add_property): Value stored to `fp` is never read. * src/sdf/ftbsdf.c (bsdf_init_distance_map): Value stored to `pixel` is never read. * src/sdf/ftsdf.c (split_sdf_shape): Value stored to `error` is never read.
Eli Schwartz d6a5c577 2021-12-13T23:40:16 * meson.build: Optimize lookup for `python3` program. The python module's `find_installation` method is intended to provide routines for compiling and installing python modules into the `site-packages` directory. It does a couple of slow things, including run an introspection command to scrape sysconfig info from the detected interpreter, which are not needed for the sole use case of invoking the found installation as an executable. Furthermore, when invoked without the name or path of a python binary, it is hardcoded to always look for `python3` corresponding to the interpreter meson itself uses to run. So using `find_installation` did not even allow detecting `python2` as a fallback. Instead, switch to a simple `find_program` lookup that finishes as soon as the program is found.
Eli Schwartz 57fd6180 2021-12-13T23:33:03 * builds/meson/*.py: Fix name of python executable for auxiliary scripts. The previous change to check the return code of `run_command` invocations caused the CI to fail. Although most scripts used `python_exe` as the program command, the script to determine the project version did not. But, all scripts used `python` as the shebang, and this is not available on all systems. Particularly Debian does not provide a `python` command, though `python3` does exist. This meant that formerly the version number was lacking, and now the build simply fails. Instead, rely on `python3` since it is guaranteed to exist when running meson, and `python2` is end of life anyway.
Eli Schwartz e342f83c 2021-12-13T22:50:18 * meson.build: Check the return value of `run_command`. By default, errors are not checked and a command that is somehow broken will just capture incorrect output (likely an empty string). Current development versions of meson now raise a warning for this implicit behavior, and advise explicitly setting the `check:` keyword argumend to determine whether a failing return code should be considered an error. Since none of the commands in this project are expected to fail, mark them as required to succeed.
Alexei Podtelezhnikov 0da2a115 2021-12-13T11:44:24 [truetype] Upstream the hdmx binary search. * src/truetype/ttobjs.h (TT_SizeRec): Add `widthp` for the hdmx widths. * src/truetype/ttobjs.c (tt_size_reset): Initialize `widthp` even though it might never be used by the interpreter. * src/truetype/ttgload.c (tt_loader_init): Avoid repeated searches in the hdmx table.
Alexei Podtelezhnikov fd03dcc1 2021-12-12T12:29:04 [truetype] Reset the IUP-called flags for each subglyph. This fixes fall-out from 7809007a5b88b15, where the composite accents were no longer hinted. * src/truetype/ttgload.c (ttloader_init): Move the IUP-called flag initialization from here... * src/truetype/ttinterp.c (TT_Run_Context): ... to here.
Alexei Podtelezhnikov 7add5b2b 2021-12-11T22:54:06 [truetype] Binary search through the `hdmx` records. The `hdmx` table is supposed to be sorted by ppem size, which enables binary search. We also drop the check for the sufficient length of the record because it is now enforced when the table is loaded. * include/freetype/internal/tttypes.h (TT_FaceRec): Store the `hdmx` record pointers sorted by ppem instead of ppem's themselves. * src/truetype/ttpload.c (tt_face_load_hdmx): Prudently sort records. (tt_face_get_device_metrics): Implement binary search to retrieve advances.
Alexei Podtelezhnikov a8ef33e3 2021-12-11T22:42:46 [truetype] Honor FT_LOAD_ADVANCE_ONLY if `hdmx` is usable. This simply shortcuts the glyph loading if FT_LOAD_ADVANCE_ONLY is specified by FT_Get_Advances and the `hdmx` data are located. Particularly, the classic v35 interpreter or "verified" ClearType fonts might see 100x speed up in retrieving the hdmx cache. * src/truetype/ttgload.c (TT_Load_Glyph): Insert the shortcut.
Alexei Podtelezhnikov 6c831d65 2021-12-11T22:34:27 [truetype] Initialize the loader with `hdmx` data. The `hdmx` matching can be done before the glyph is loaded. * include/freetype/internal/tttypes.h (TT_LoaderRec): Add a field. * src/truetype/ttgload.c (compute_glyph_metrics): Relocate the `hdmx` code from here... (tt_loader_init): ... to here, before the glyph is loaded.
Alexei Podtelezhnikov 7809007a 2021-12-11T22:22:57 [truetype] Relocate subpixel flag setting. `TT_RunIns` is too busy to deal with subpixel flags. It is better to set them in `tt_loader_init`, which is executed before each glyph program. * src/truetype/ttinterp.c (TT_RunIns): Move the flag setting from here... * src/truetype/ttgload.c (tt_loader_init): ... to here.
Alexei Podtelezhnikov a35b081e 2021-12-11T22:12:25 [truetype] Limit INSTCTRL appication within specs. * src/truetype/ttinterp.c (Ins_INSTCTRL): Limit its global effects to the CVT program and local effects to the glyph program. This also fixes an Infinality buglet. The `ignore_x_mode` should be locally unset by the glyph program.
Ben Wagner bad92be9 2021-12-09T17:06:28 [bdf] Fix use of uninitialized value. In _bdf_readstream if the data contained no newline then the buffer would continue to grow and uninitialized data read until either the uninitialized data contained a newline or the buffer reached its maxiumum size. The assumption was that the line was always too long and the buffer had been filled, however this case can also happen when there is not enough data to fill the buffer. Correct this by properly setting the cursor to the end of the available data, which may be different from the end of the buffer. This may still result in one extra allocation, but only on malformed fonts. * src/bdf/bdflib.c (_bfd_readstream): Correctly update cursor. Remove unread set of `avail`. Bug: https://lists.nongnu.org/archive/html/freetype-devel/2021-12/msg00001.html
Alexei Podtelezhnikov 012b00f3 2021-12-07T10:19:06 [truetype] Reduce Infinality footprint again. * src/truetype/ttgload.c (compute_glyph_metrics): Streamline and prioritize the Infinality checks to use `hdmx`.
Cameron Cawley 1f951898 2021-12-06T23:08:46 [builds/windows] Guard some non-ancient API. We can support Windows 98 and NT 4.0 in principle... * builds/windows/ftdebug.c, builds/windows/ftsystem.c: Check for the ancient SDK using _WIN32_WINDOWS, _WIN32_WCE, or _WIN32_WINNT.
Cameron Cawley 9a533aa2 2021-12-06T21:46:47 * builds/windows/visualc/freetype.vcproj: Add missing file.