• Show log

    Commit

  • Hash : dbf9142f
    Author : Jesse Towner
    Date : 2021-02-25T15:07:25

    [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`
    

  • Properties

  • Git HTTP https://git.kmx.io/kc3-lang/freetype.git
    Git SSH git@git.kmx.io:kc3-lang/freetype.git
    Public access ? public
    Description
    Users
    thodg_m kc3_lang_org thodg_w www_kmx_io thodg thodg_l
    Tags