freetype2/src
Jesse Towner dbf9142f7e [sfnt] Fix crash in `Load_SBit_Png` on Windows x64.
This change fixes a crash that occurs in `Load_SBit_Png` when
running on a 64-bit Windows OS.  A memory access violation exception
would be raised by `setjmp` if the `jmp_buf` is not aligned to a
16-byte memory boundary.  This is due to setjmp executing `movdqa`
instructions to store 128-bit XMM registers to memory, which require
correct memory alignment.  This problem occurs because
`png_create_read_struct` uses `malloc` and `free` for memory
management, which only guarantees 8-byte alignment on Windows.

Instead, to fix the problem, `png_create_read_struct_2` is used on
64-bit Windows, which allows for user-defined memory allocation and
deallocation callbacks to be specified.  These callbacks forward the
allocation and deallocation requests to `_aligned_alloc` and
`_aligned_free`, ensuring that the allocated `png_struct` and
internal `jmp_buf` have the requisite 16-byte alignment.

* src/sfnt/pngshim.c <_WIN64>: Include `malloc.h`.
(malloc_callback, free_callback) <_WIN64>: New functions.
(Load_SBit_Png) <_WIN64>: Use `png_create_read_struct_2` instead of
`png_create_read_struct`
2021-02-27 13:28:13 +01:00
..
autofit [afshaper] Fix hb_ot_tags_from_script deprecation warning. 2021-01-17 17:33:50 +00:00
base Add new function `FT_Get_Transform`. 2021-02-13 08:52:58 +01:00
bdf Decorate qsort callbacks with cdecl. 2021-02-12 19:28:05 -05:00
bzip2 Update all copyright notices. 2021-01-17 07:18:48 +01:00
cache * src/*: Don't use more than one '\n' in `FT_TRACE` and `FT_ERROR`. 2021-02-04 07:46:46 +01:00
cff * src/*: Don't use more than one '\n' in `FT_TRACE` and `FT_ERROR`. 2021-02-04 07:46:46 +01:00
cid * src/*: Don't use more than one '\n' in `FT_TRACE` and `FT_ERROR`. 2021-02-04 07:46:46 +01:00
dlg Update all copyright notices. 2021-01-17 07:18:48 +01:00
gxvalid Decorate qsort callbacks with cdecl. 2021-02-12 19:28:05 -05:00
gzip Update all copyright notices. 2021-01-17 07:18:48 +01:00
lzw Update all copyright notices. 2021-01-17 07:18:48 +01:00
otvalid Update all copyright notices. 2021-01-17 07:18:48 +01:00
pcf * src/*: Don't use more than one '\n' in `FT_TRACE` and `FT_ERROR`. 2021-02-04 07:46:46 +01:00
pfr * src/*: Don't use more than one '\n' in `FT_TRACE` and `FT_ERROR`. 2021-02-04 07:46:46 +01:00
psaux Decorate qsort callbacks with cdecl. 2021-02-12 19:28:05 -05:00
pshinter Update all copyright notices. 2021-01-17 07:18:48 +01:00
psnames Decorate qsort callbacks with cdecl. 2021-02-12 19:28:05 -05:00
raster Update all copyright notices. 2021-01-17 07:18:48 +01:00
sdf Update all copyright notices. 2021-01-17 07:18:48 +01:00
sfnt [sfnt] Fix crash in `Load_SBit_Png` on Windows x64. 2021-02-27 13:28:13 +01:00
smooth Update all copyright notices. 2021-01-17 07:18:48 +01:00
tools Move 'dlg' submodule to `subprojects` directory. 2021-02-16 14:07:18 +01:00
truetype * src/*: Don't use more than one '\n' in `FT_TRACE` and `FT_ERROR`. 2021-02-04 07:46:46 +01:00
type1 Decorate qsort callbacks with cdecl. 2021-02-12 19:28:05 -05:00
type42 Update all copyright notices. 2021-01-17 07:18:48 +01:00
winfonts * src/*: Don't use more than one '\n' in `FT_TRACE` and `FT_ERROR`. 2021-02-04 07:46:46 +01:00