Skip to content

Sanitize coverage table results during shaping.#516

Merged
JimBobSquarePants merged 1 commit intomainfrom
js/fix-514
Mar 18, 2026
Merged

Sanitize coverage table results during shaping.#516
JimBobSquarePants merged 1 commit intomainfrom
js/fix-514

Conversation

@JimBobSquarePants
Copy link
Copy Markdown
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Fixes #514

This pull request improves the robustness of font table lookup and substitution logic by adding comprehensive bounds checks to prevent out-of-range access. It also updates several tests to use new or renamed test font references and introduces a new test and font file for Issue 514.

Enhancements to font lookup and substitution safety:

  • Added upper bounds checks in all TryUpdatePosition and TrySubstitution methods for GPOS and GSUB lookup subtable classes, ensuring coverage indices are within valid array bounds before accessing records or tables. This prevents potential out-of-range exceptions during font processing. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19]

Test improvements and new test coverage:

  • Updated test font references in multiple issue tests to use new or renamed identifiers, improving clarity and consistency in test code. [1] [2] [3] [4]
  • Added a new test file (tests/Fonts/Issues/Issue514.ttf) and corresponding test class (tests/SixLabors.Fonts.Tests/Issues/Issues_514.cs) to ensure correct handling of LookupType2Format1SubTable, addressing Issue 514. [1] [2]

@JimBobSquarePants JimBobSquarePants merged commit 6f293b9 into main Mar 18, 2026
24 checks passed
@JimBobSquarePants JimBobSquarePants deleted the js/fix-514 branch March 18, 2026 07:10
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 18, 2026

Codecov Report

❌ Patch coverage is 86.36364% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 82%. Comparing base (0e53431) to head (5e285ef).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...es/AdvancedTypographic/GPos/LookupType8SubTable.cs 60% 0 Missing and 2 partials ⚠️
...es/AdvancedTypographic/GPos/LookupType7SubTable.cs 50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #516   +/-   ##
=====================================
- Coverage     82%     82%   -1%     
=====================================
  Files        305     305           
  Lines      21530   21532    +2     
  Branches    3164    3164           
=====================================
+ Hits       17817   17818    +1     
  Misses      2900    2900           
- Partials     813     814    +1     
Flag Coverage Δ
unittests 82% <86%> (-1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IndexOutOfRangeException in LookupType2Format1SubTable.TryUpdatePosition

1 participant