Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Out of Bounds Text Drawing #304

Merged
merged 2 commits into from
Oct 31, 2023
Merged

Conversation

JimBobSquarePants
Copy link
Member

@JimBobSquarePants JimBobSquarePants commented Oct 31, 2023

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 #301

The DrawTextProcessor allowed rendered buffers that exceeded the width of the image frame. This PR clamps the length of the span passed to the brush applicator. Our other processors correctly limit the span length.

I also added colorstop stable sorting to the gradient brush since I spotted the TODO while debugging.

@codecov
Copy link

codecov bot commented Oct 31, 2023

Codecov Report

Merging #304 (758b7b4) into main (85721f8) will decrease coverage by 1%.
The diff coverage is 85%.

@@         Coverage Diff         @@
##           main   #304   +/-   ##
===================================
- Coverage    80%    80%   -1%     
===================================
  Files        97     97           
  Lines      4937   4946    +9     
  Branches    881    884    +3     
===================================
+ Hits       3990   3997    +7     
- Misses      753    754    +1     
- Partials    194    195    +1     
Flag Coverage Δ
unittests 80% <85%> (-1%) ⬇️

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

Files Coverage Δ
...ssing/Processors/Text/DrawTextProcessor{TPixel}.cs 80% <100%> (ø)
src/ImageSharp.Drawing/Processing/GradientBrush.cs 81% <84%> (-1%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@JimBobSquarePants JimBobSquarePants merged commit 2316146 into main Oct 31, 2023
@JimBobSquarePants JimBobSquarePants deleted the js/fix-oob-text-drawing branch October 31, 2023 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working text
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specified argument was out of the range of valid values
2 participants