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

isExteriorRing overflows stack on infinite loop in union #69

Closed
terrencecrowley opened this issue Feb 18, 2019 · 4 comments
Closed

isExteriorRing overflows stack on infinite loop in union #69

terrencecrowley opened this issue Feb 18, 2019 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@terrencecrowley
Copy link

The function _calcEnclosingRing ends up returning the current ring. This causes isExteriorRing to recurse and stack overflow since it always defers to its enclosingRing (which is the same object in the case of this bug).

A simple patch to prevent this clear error by testing whether _calcEnclosingRing returns the current object and returning undefined in that case appears to fix the problem although I assume there is some deeper underlying issue that is not resolved by that fix and have not done enough testing to verify that that fix doesn't have other bad consequences.

Apologies I don't have a small repro case.

@pentacular
Copy link

pentacular commented Feb 18, 2019

Ah, I came to report this too.

Fortunately, I have a small reproducible case. :)

union([[[2, -2], [1, -1], [0, -2]]],
      [[[1, -1], [0, -1], [0, -2]]],
      [[[2, -2], [2,  0], [1, -1]]])

@mfogel mfogel self-assigned this Feb 18, 2019
@mfogel mfogel added this to the v0.12.4 milestone Feb 18, 2019
@mfogel
Copy link
Owner

mfogel commented Feb 18, 2019

awesome, thank you for the bug report. I've reproduced the issue on my side.

@pentacular - simple coordinates like that are like a dream. thank you!

@mfogel mfogel added the bug Something isn't working label Feb 18, 2019
@mfogel mfogel closed this as completed in d937614 Feb 18, 2019
@mfogel
Copy link
Owner

mfogel commented Feb 18, 2019

I just pushed a fix for this to master. The fix will be included in the next release to NPM, which I'm planning to push out in a week or two. Let me know if you run into any issues with the fix... cheers!

@terrencecrowley
Copy link
Author

terrencecrowley commented Feb 18, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants