Closed roelvandijk closed 6 years ago
The segfault is caused when you pass polygons to fillPoly
containing 0 points. Having at least 1 point in each polygon prevents the error.
I suspect this is a bug in our withPolygons
function. Notice how it uses withArrayPtr
to create the polygons in memory. It uses allocaBytes
to allocate memory for each polygon. But the polygons are 0 points. So what happens if you allocate 0 bytes? allocaBytes
must provide a pointer, but where does that pointer point to?
Fixed by 3642a95f2326d718d5bb98f21e24273042706812
As witnessed by ab918f0a4b427bf8c289b91ca99fc87859a492e0 the fillPoly function can cause a segmentation fault.
The tests generate random images on which random polygons are drawn. I'll have to use the option that prints all quickcheck data that is generated, because it is not printed after the error (the segfault kills the RTS).