Comments (11)
@ericfischer with the latest fixes are you still seeing any polygons that don't finish/hang? With the fuzzer port to mapnik-vt (https://github.com/mapbox/mapnik-vector-tile/blob/master/bin/vtile-fuzz.cpp) I'm not. Also I originally only saw crashes and no hangs.
from clipper.
Thanks @springmeyer. I did just get it to crash on this fuzz polygon but haven't looked into what exactly went wrong yet.
In general it seems to take O(n^4) time with the number of sides, so it can get slow, but I haven't seen it fail to complete.
from clipper.
@ericfischer - interesting. Would it be possible to capture the rand()
values that were the way that polygon was generated as well? I want to try plugging those same values into the mapnik-vt fuzzer port and make sure it also crashes/produces the same polygons.
from clipper.
I got it to crash again, this time in the debugger, and it was here:
* thread #1: tid = 0x1e4bef, 0x00000001000132b0 a.out`ClipperLib::Clipper::FixIntersects(this=0x00007fff5fbffa10, dupeRec=0x00007fff5fbff820, op_j=<unavailable>, op_k=<unavailable>, outRec_j=<unavailable>, outRec_k=<unavailable>) + 1392 at clipper.cpp:4746, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x20)
frame #0: 0x00000001000132b0 a.out`ClipperLib::Clipper::FixIntersects(this=0x00007fff5fbffa10, dupeRec=0x00007fff5fbff820, op_j=<unavailable>, op_k=<unavailable>, outRec_j=<unavailable>, outRec_k=<unavailable>) + 1392 at clipper.cpp:4746
4743 // Check for connection through chain of other intersections
4744 for (auto it = range.first; it != range.second; ++it)
4745 {
-> 4746 OutRec * itRec = GetOutRec(it->second.op2->Idx);
4747 if (itRec->Idx != outRec_search->Idx &&
4748 op_origin_2->Pt != it->second.op2->Pt &&
4749 (outRec_parent == itRec || outRec_parent == ParseFirstLeft(itRec->FirstLeft)) &&
I'll start logging the random seed for easier reproducibility.
from clipper.
Here's a reliable crasher, with srand(1461434208)
.
► c++ -g -std=c++11 -Wall -O3 abuse.cc cpp/clipper.cpp
► ./a.out
620 sides
Segmentation fault: 11
from clipper.
Here's a reliable crasher, with srand(1461434208).
@ericfischer - your fuzzer uses 3 rand()
calls right? Can you provide all three?
from clipper.
@ericfischer when you've got the rand()
necessary pass them off to @flippmoke as he's planning on looking into this today.
from clipper.
I'm not sure quite what you are asking, @springmeyer. The code linked above that crashes calls rand()
in four places:
- to determine the number of points to produce
- the x coordinate of each point
- the y coordinate of each point
- a 1-in-50 chance of closing the ring and starting another one.
Here is a list of the values that rand
produces with a seed of 1461434208. Here are the coordinates of the points around each ring.
from clipper.
And the difference between this and your fuzzer, in addition to all the looping over various options that you do, is that it looks like you have an extra check to close the ring when it gets to have 100 points in it, which reduces the level of complexity that Clipper is asked to handle.
from clipper.
@ericfischer I found the bug in the code -- it should be fixed in 9edc292
from clipper.
Thanks @flippmoke! It's looking good to me.
from clipper.
Related Issues (4)
- Debian packaging HOT 4
- Reproducible free-without-malloc crash HOT 2
- Unclean geometries HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clipper.