-
Notifications
You must be signed in to change notification settings - Fork 129
added fuzzer cases #633
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
added fuzzer cases #633
Conversation
interesting, will check them tonight. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #633 +/- ##
=======================================
Coverage 91.40% 91.40%
=======================================
Files 35 35
Lines 4512 4514 +2
=======================================
+ Hits 4124 4126 +2
Misses 388 388 ☔ View full report in Codecov by Sentry. |
Wait, I wasn't running the tests right. I have a repro now. |
Progress, but not quite there yet. It's late, I'll pick this up tomorrow. |
{-3.f, 3.f}, // | ||
}); | ||
polys.push_back({ | ||
{1.40282347e+38f, 1.40282347e+38f}, // |
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.
I cut these down by a factor of ~2 because for the duplicated test case (two copies next to each other), one coordinate went to inf
, so the calculated precision went to inf
, and apparently CCW
returns -1 when both the coordinate and the precision are inf
. This doesn't seem to cause any problems in the algorithm, but our geometric check at the end is wrong. That doesn't feel like a bug particularly worth fixing, so I reduced the value a touch so that the test functions.
@@ -286,7 +286,8 @@ class EarClip { | |||
VertItr center = tail; | |||
VertItr last = center; | |||
|
|||
while (nextL != nextR && tail != nextR) { | |||
while (nextL != nextR && tail != nextR && | |||
nextL != (toLeft ? right : left)) { |
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.
This fixed the infinite loop
@@ -550,6 +551,9 @@ class EarClip { | |||
auto vert = poly.begin(); | |||
polygon_.push_back({vert->idx, earsQueue_.end(), vert->pos}); | |||
const VertItr first = std::prev(polygon_.end()); | |||
|
|||
bound = glm::max( | |||
bound, glm::max(glm::abs(first->pos.x), glm::abs(first->pos.y))); |
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.
Here I was missing a point in my precision calc, so if the first point was extreme it got the wrong precision.
Btw, I tried running the two fuzzer cases for several minutes and was unable to find crashing/infinite loop cases. I guess the robustness is much better now. Will try to write the fuzzer for valid/ε-valid inputs. |
* added fuzzer cases * not infinite looping anymore * fixed loop check * fixed bound calc
@pca006132 here I've added your two failing test cases from #620, but they aren't failing on my mac.