8000 added fuzzer cases by elalish · Pull Request #633 · elalish/manifold · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 4 commits into from
Dec 4, 2023
Merged

added fuzzer cases #633

merged 4 commits into from
Dec 4, 2023

Conversation

elalish
Copy link
Owner
@elalish elalish commented Dec 2, 2023

@pca006132 here I've added your two failing test cases from #620, but they aren't failing on my mac.

@elalish elalish self-assigned this Dec 2, 2023
@pca006132
Copy link
Collaborator

interesting, will check them tonight.

Copy link
codecov bot commented Dec 2, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0149e48) 91.40% compared to head (a97e1da) 91.40%.

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.
📢 Have feedback on the report? Share it here.

@elalish
Copy link
Owner Author
elalish commented Dec 2, 2023

Yeah, since everything is passing, I guess this PR is not needed. But maybe the problem polygons were output wrong? Or maybe they need to be tested at a particular precision?

Wait, I wasn't running the tests right. I have a repro now.

@elalish
Copy link
Owner Author
elalish commented Dec 2, 2023

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}, //
Copy link
Owner Author

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)) {
Copy link
Owner Author

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)));
Copy link
Owner Author

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.

@elalish elalish merged commit 638bada into master Dec 4, 2023
@elalish elalish deleted the fuzzerBug branch December 4, 2023 02:14
@pca006132
Copy link
Collaborator

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.

@elalish elalish mentioned this pull request Jan 7, 2024
cartesian-theatrics pushed a commit to cartesian-theatrics/manifold that referenced this pull request Mar 11, 2024
* added fuzzer cases

* not infinite looping anymore

* fixed loop check

* fixed bound calc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0