-
-
Notifications
You must be signed in to change notification settings - Fork 855
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 IndexOutOfRangeException in FillRegionProcessor #964
Fix IndexOutOfRangeException in FillRegionProcessor #964
Conversation
Codecov Report
@@ Coverage Diff @@
## master #964 +/- ##
==========================================
+ Coverage 89.65% 89.66% +0.01%
==========================================
Files 1097 1097
Lines 48542 48573 +31
Branches 3425 3425
==========================================
+ Hits 43520 43553 +33
+ Misses 4319 4317 -2
Partials 703 703
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #964 +/- ##
=========================================
+ Coverage 89.68% 89.7% +0.01%
=========================================
Files 1097 1097
Lines 48474 48506 +32
Branches 3420 3420
=========================================
+ Hits 43476 43510 +34
+ Misses 4295 4293 -2
Partials 703 703
Continue to review full report at Codecov.
|
Thanks! @101100 !! We'll have a good look at that asap. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good. Thanks for the fix
Thanks for the quick merge! I tested this in my project with the nightly build |
…tion-in-fillregionprocessor Fix IndexOutOfRangeException in FillRegionProcessor
Prerequisites
Description
This is a fix for an issue that I have discovered as well as the reported issue #928. I have added two tests to illustrate the issue that fail on
master
as well as a possible fix.The issue arises due to this code:
ImageSharp/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillRegionProcessor{TPixel}.cs
Lines 99 to 112 in aac8eae
If
pointsFound
is odd (such as 3) and equal to the size of the buffer, the loop will go up tobuffer.Length - 1
, but that means thatbuffer[point + 1]
will be out of bounds and cause an exception.My solution was to add a second condition to the loop:
point < buffer.Length - 1
Unfortunately, I don't know enough about the algorithm to know if this will result in an incorrect result.