From d786cccef4cdbfcdb72986fb22009f6ebdb1867c Mon Sep 17 00:00:00 2001 From: Jonathan Schwender Date: Thu, 9 May 2024 20:13:39 +0200 Subject: [PATCH 1/2] Update CI actions - Update the runner-os - Update the used actions, since the node version is deprecated. --- .github/workflows/ci.yml | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc4147d..b363d73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,15 +20,11 @@ jobs: name: Linux runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 2 - name: Setup Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - default: true - override: true + uses: dtolnay/rust-toolchain@stable - name: Install run: | echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections; @@ -42,17 +38,13 @@ jobs: ci-macos: name: macOS - runs-on: macos-12 + runs-on: macos-14 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 2 - name: Setup Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - default: true - override: true + uses: dtolnay/rust-toolchain@stable - name: Build run: cargo build - name: Tests @@ -60,17 +52,13 @@ jobs: ci-win: name: Windows - runs-on: windows-2019 + runs-on: windows-2022 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 2 - name: Setup Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - default: true - override: true + uses: dtolnay/rust-toolchain@stable - name: Build run: cargo build - name: Tests From dd6d87e40f21c15389c3835f98f1bb5a99238530 Mon Sep 17 00:00:00 2001 From: Jonathan Schwender Date: Thu, 9 May 2024 20:26:48 +0200 Subject: [PATCH 2/2] freetype: Early return if no contours. Fixes the Safety precondition > `data must be non-null and aligned even for zero-length slices` --- src/loaders/freetype.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/loaders/freetype.rs b/src/loaders/freetype.rs index 538ec28..2a27fc0 100644 --- a/src/loaders/freetype.rs +++ b/src/loaders/freetype.rs @@ -463,6 +463,9 @@ impl Font { } let outline = &(*(*self.freetype_face).glyph).outline; + if outline.n_contours == 0 { + return Ok(()); + } let contours = slice::from_raw_parts(outline.contours, outline.n_contours as usize); let point_positions = slice::from_raw_parts(outline.points, outline.n_points as usize); let point_tags = slice::from_raw_parts(outline.tags, outline.n_points as usize);