Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
FreeType
FreeType
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 72
    • Issues 72
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 1
    • Merge Requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Metrics
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • FreeType
  • FreeTypeFreeType
  • Merge Requests
  • !15

Closed
Created Feb 25, 2021 by Jesse Towner@jwtowner
  • Report abuse
Report abuse

[sfnt] Fix crash in Load_SBit_Png on Windows x64

  • Overview 6
  • Commits 2
  • Changes 1

This merge request fixes issue #1037 (closed) describing 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.

Thanks!

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: master