Commit Graph
6 Commits
Author SHA1 Message Date
Khaled Hosny bd306afedb [face] Ignore named-instance bits in hb_face_create_or_fail() (#6571)
Fixes: https://github.com/harfbuzz/harfbuzz/issues/6567
2026-11-04 12:02:49 -06:00
Behdad Esfahbod fcb6557402 [face] Duplicate the loader environment value instead of borrowing it (#6502)
get_default_loader_name() cached the pointer returned by
getenv("HB_FACE_LOADER") for the process lifetime.  That storage is
owned by the C runtime or the caller and may change or be freed after
the lookup, leaving the cached pointer dangling.

Duplicate the value on first use and hold onto the copy, rather than
caching the borrowed pointer or calling getenv() on every face load.
Use the existing hb_lazy_loader_t pattern (as static_face_loader_list
does): an unset or empty value, or an allocation failure, caches the
empty-string default; a non-empty value is copied with hb_malloc and
freed via hb_atexit.

Add an api smoke test that loads the fixture through the file and blob
default-loader entry points (loader == NULL) with HB_FACE_LOADER set,
then restores the caller's environment.  Its value is LSan coverage of
the copy-and-free path in the asan-ubsan job; glibc's setenv() does not
free replaced strings, so the borrowed-pointer bug is not observable on
Linux.  Verified: full meson test suite (275 tests) and test-face under
ASan/UBSan with leak detection enabled both pass.

Alternative to #6493, following review feedback there.

Assisted-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-30 17:47:06 -06:00
Behdad Esfahbod 155e1e633b [test/api] Use g_assert_true instead of g_assert
The latter terminates the program. The former marks the test
as failing.
2025-04-06 03:49:15 -06:00
Behdad Esfahbod 379688c566 [test-face] Relax on face load failure 2025-03-13 14:47:34 -06:00
Behdad Esfahbod 759e1881e8 [coretext] Fix loading TTC files 2025-03-11 12:46:27 -06:00
Behdad Esfahbod 8687f5c38e [face] Add tests for new constructors 2025-03-11 11:56:00 -06:00