* src/cff/cffgload.c (cff_slot_load): The `horiAdvance` value needs
an adjustment for a non-uniform scaling matrix when it came from a raw CFF
data blob but not for the OpenType/CFF case when an 'hmtx' table is
available. Similarly, the `vertAdvance` value does never come from the
CFF data blob so it doesn't need adjustment.
* src/cff/cffgload.c (cff_slot_load): When there is an 'hmtx' table
available, don't use its `horiBearingX` information as that gets
unconditionally overruled based on the result of `FT_Outline_Get_CBox` later
on.
* src/cff/cffgload.c (cff_slot_load): Don't adjust
`FT_GlyphMetrics::{horiAdvance,vertAdvance}` for non-zero font matrix
offsets as these are vectors, not points.
* src/cid/cidgload.c (cid_slot_load_glyph): Likewise.
* src/cid/type1/t1gload.c (T1_Load_Glyph): Likewise.
* src/type1/t1gload.c (T1_Get_Advances): Take non-uniform font matrix
xx vs yy scaling into account.
(T1_Load_Glyph) [linearHoriAdvance]: Likewise.
* src/cid/cidgload.c (cid_slot_load_glyph) [linearHoriAdvance]: Likewise.
* src/cff/cffgload.c (cff_slot_load) [linearHoriAdvance]: Likewise.
Including different top/sub font units_per_em values.
If the allocation of `tuplescalars` fails, `tuplecoords` was left in
place, to be overwritten and leaked by the next call.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(hash_rehash): If the new table cannot be allocated, keep the old one
instead of leaking it and leaving `hash->table` at `NULL`.
(hash_insert): Undo the insertion if the table cannot grow.
(ft_hash_str_free): Handle a hash whose table `hash_init` could not
allocate.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The `cff` module takes its MM service from the `truetype` module. If
the library has no such module, `face->mm` is `NULL`, yet a CFF2 font
with an `fvar` table was still flagged as a variation font, and
`cff_set_named_instance` crashed while opening it.
To reproduce, remove the `truetype` module with `FT_Remove_Module` and
open a CFF2 variation font. Such a font now opens at its default
instance.
* src/sfnt/sfobjs.c (sfnt_init_face): Ignore `fvar` without the MM
service.
* src/psaux/psft.c (cf2_getNormalizedVector): Return an empty vector
without the MM service.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
If `af_reverse_character_map_new` fails, the map is `NULL`. This
happens if there is no Unicode charmap, or if memory is exhausted. The
lookups in the Latin hinter passed it on to `ft_hash_num_lookup`, which
dereferences it.
To reproduce, set the `fallback-script` property to Latin and load a
glyph of a font without a Unicode charmap with `FT_LOAD_FORCE_AUTOHINT`.
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments,
af_latin_hints_apply): Check `reverse_charmap`.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`FT_Outline_Get_BBox` can return a box that leaves out an on-curve point.
When a cubic's control points reach above the box's current maximum but the
curve itself stays below it, `cubic_peak` returns a negative value and
`BBox_Cubic_Check` adds it, lowering `*max` (and, the other way, raising
`*min`).
Patch provided by @Lynth-KR.
Fixes issue #1489.
Both 'region_count' and 'axis_count' are read as USHORT with the
former further capped at 32767. Their product will never overflow.
It is the multiplication by 6 that does it.
* src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Update.
This is only relevant on macOS platforms.
* builds/mac/ftmac.c (lookup_lwfn_by_fond): Correctly handle and check
`base_lwfn`, which is a Pascal string.
(read_lwfn): Check PFB chunk size.
Fixes issue #1481.
This is especially necessary for environments like Windows where `long` is
32-bit.
* src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Add guard for
variation region list size.
Fixes issue #1484.
This reverts 67cf7a88 to unsigned refcounts, with conditional decrements.
* include/freetype/internal/ftobjs.c (FT_Face_InternalRec,
FT_LibraryRec): Make `refcount' unsigned.
* src/base/ftobjs.c (FT_New_Library, ft_open_face_internal): Keep it zero.
(FT_Done_Library, FT_Done_Face): ... and decrement it conditionally.
`RTLD_DEFAULT` is an ordered process-wide search scope, not a handle for one
library. When Android's platform HarfBuzz precedes an application-provided
HarfBuzz:
* Common symbols such as hb_version_atleast resolve to the old platform
copy.
* A symbol absent from that copy can resolve to the newer application copy.
* Resolving every function independently can therefore assemble a function
table from incompatible HarfBuzz ABIs.
The existing code already avoids loading another HarfBuzz when one is
visible. The problem is that it continues resolving functions against the
process-wide scope.
* src/autofit/ft-hb.c (ft_hb_funcs_init): Use `RTLD_DEFAULT` only to
discover HarfBuzz, then resolve the complete API from a concrete provider.
If the initial provider lacks a required symbol but `RTLD_DEFAULT` finds
that symbol in another binary, treat the second binary as a new candidate
and reassess the entire API against its concrete handle (using the
temporarily defined macro `CHECK_PROVIDER`). Accept it only if it
supplies every required function; never retain a mixed table.
The reassessment is bounded to one retry, preventing incomplete providers
from cycling.
Fixes issue #1479.
Despite its name, this option only gated 'avar' version 2 support.
FreeType 2.15.0 includes the complete boring-expansion set of proposals,
now released as ISO Open Font Format, fifth edition
(ISO/IEC 14496-22:2026). Gating just avar2 no longer makes sense,
especially since it has also been shipping on Apple platforms for
four years.
* include/freetype/config/ftoption.h, devel/ftoption.h
(TT_CONFIG_OPTION_NO_BORING_EXPANSION): Remove.
* src/truetype/ttgxvar.c (ft_var_load_avar): Remove configuration guards.
* docs/CHANGES: Updated.
All five Meson regression tests pass with the removed macro still
defined. avar1 and avar2 coordinate mapping agrees with FontTools.
Assisted-by: OpenAI Codex
Static VARC fonts can have private variation axes without an 'fvar'
table or public MM metadata. Use the blend's axis count when validating
'avar' and item variation stores, avoiding a null 'mmvar' dereference
when loading HVAR or VVAR for a VARC component.
* src/truetype/ttgxvar.c (ft_var_load_avar,
tt_var_load_item_variation_store): Use blend->num_axis.
* tests/varc/make-hvvar-fonts.py: Generate HVAR and VVAR fixtures from
the static VARC/gvar font using only Python's standard library.
* tests/meson.build: Generate the fixtures and pass them to the VARC test.
* tests/varc/main.c (test_font, main): Test generated fixture paths.
Tests: all five Meson regression tests pass.
Fixes issue #1474.
Assisted-by: OpenAI Codex
With the incremental interface, `tt_glyph_load` accepts glyph indices beyond
`num_glyphs`, but the 'hdmx' records only hold `num_glyphs` widths.
* src/truetype/ttgload.c (TT_Load_Glyph): Don't use `loader.widthp`
for glyph indices outside of the font's glyph range.
This improves performance, fixes#1473.
* src/base/fttrigon.c (ft_trig_pseudo_rotate, ft_trig_pseudo_polarize):
Replace if-else with conditional negation by a mask.
==========================
Tag sources with `VER-2-15-0'.
* docs/VERSION.TXT: Add entry for version 2.15.0.
* docs/CHANGES: Updated.
* docs/release, docs/README, builds/macs/README: Updated.
* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.14.3/2.15.0/, s/2143/2150/.
* include/freetype/freetype.h (FREETYPE_MINOR): Set to 15.
(FREETYPE_PATCH): Set to 0.
* builds/unix/configure.raw (version_info): Set to 26:7:20.
* CMakeLists.txt (VERSION_MINOR): Set to 15.
(VERSION_PATCH): Set to 0.
Reported as
https://issues.oss-fuzz.com/issues/570754474
* src/truetype/ttvarc.c (tt_varc_parse_component): Use `MUL_INT32` for
converting 32-bit packed axis values from `F2DOT14` to `F16DOT16`.
(tt_face_load_varc_glyph): Use `NEG_LONG` when rounding negative axis
values, since the conversion can wrap to `INT32_MIN` and negating that
value overflows on platforms with 32-bit longs.
Assisted-by: OpenAI Codex
`numBlends` comes from the charstring and is attacker-controlled. Check for
overflow before multiplying: a wrapped `numOperands` would bypass the stack
underflow check below and the loop that follows would then run up to 2^32
iterations (CPU exhaustion).
A lookup can be registered under several scripts while substituting inputs
from only one of them. Collecting every output assigns those glyphs to the
first processed script, regardless of the inputs' styles. In Google Sans
this assigns the Latin rvrn alternates to Cyrillic; missing Cyrillic blue
zones then disable their hinting and darkening.
* src/autofit/afshaper.c (af_shaper_get_coverage_hb): Seed default coverage
with glyphs already assigned to the style and compute their substitution
closure through the collected lookups.
Keep the special feature coverages and their style precedence intact.
* src/autofit/ft-hb-decls.h: Add `hb_ot_layout_lookups_substitute_closure`.
* tests/issue-1441/*: New files, adding synthetic regression fonts covering
shared lookups, both feature variation records, chained substitutions,
ligatures, DFLT-only features, unreachable outputs, and preservation of
the small-cap style.
The full Meson test suite passes with linked, dynamic, and disabled
HarfBuzz. The regression fails before the fix. Google Sans alternates
retain Latin styles and stem darkening after the fix.
Assisted-by: OpenAI Codex
Fixes issue #1441.