Skip to content
This repository was archived by the owner on Mar 25, 2024. It is now read-only.
This repository was archived by the owner on Mar 25, 2024. It is now read-only.

Segfault on isValid #202

Description

@thomersch

I encountered a weird issue that seems only to come up on macOS, but also concerns calls from PostGIS.

When I execute

SELECT ST_StraightSkeleton(
	ST_Buffer(
		ST_GeomFromEWKT('SRID=3857;LINESTRING (1 1, 5 5)'), 1
	)
);

the database segfaults.

So I started to hunt down the problem and was able to reduce it to the following small C++ snippet:

#include <iostream>

#include <SFCGAL/Polygon.h>
#include <SFCGAL/algorithm/isValid.h>

int main(int argc, const char * argv[]) {
	SFCGAL::Polygon poly;
	poly.exteriorRing().addPoint(SFCGAL::Point(2, 1));
	poly.exteriorRing().addPoint(SFCGAL::Point(1, 0));
	poly.exteriorRing().addPoint(SFCGAL::Point(0, 1));
	poly.exteriorRing().addPoint(SFCGAL::Point(1.01, 2));
	poly.exteriorRing().addPoint(SFCGAL::Point(2, 1));
	
	std::cout << SFCGAL::algorithm::isValid(poly) << std::endl;
	return 0;
}

This runs fine on Linux, but not on macOS. Not sure where the issue originates, but I saw that in those cases libgmp receives some very suspicious data structures which contain null pointers.

sfcgal 1.3.7, cgal 4.14.1, gmp 6.2.0

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions