Opened 9 years ago

Closed 6 years ago

#3255 closed defect (fixed)

Garden crash SFCGAL ST_3DDifference with malformed polygons

Reported by: robe Owned by: colivier
Priority: high Milestone: PostGIS SFCGAL
Component: sfcgal Version: master
Keywords: Cc:

Description

On

POSTGIS="2.2.0dev r13966" GEOS="3.5.0-CAPI-1.9.0 r4088" SFCGAL="1.1.0" PROJ="Rel. 4.9.1, 04 March 2015" GDAL="GDAL 2.0.0, released 2015/06/14" LIBXML="2.7.8" LIBJSON="0.12" RASTER
SELECT ST_3DDifference('POINT(-11.1111111 40)'::geometry, 'POLYGON((1 2,1 2,1 2,1 2))'::geometry) As result

crashes server.

Attachments (1)

ticket_3255.patch.txt (1.2 KB ) - added by hmercier 6 years ago.
Patch to add a regression test for #3255

Download all attachments as: .zip

Change History (6)

comment:1 by robe, 9 years ago

POSTGIS="2.2.0dev r13992" GEOS="3.5.0-CAPI-1.9.0 r4088" SFCGAL="1.2.0" PROJ="Rel. 4.9.1, 04 March 2015" GDAL="GDAL 2.0.0, released 2015/06/14 GDAL_DATA not found" LIBXML="2.7.8" LIBJSON="0.12" RASTER

Still crashes.

bakctrace:

#0  0x000000006d30c900 in libSFCGAL!_ZN6SFCGAL7VersionEv () from C:\ming64gcc48\projects\postgresql\rel\pg9.4w64gcc48edb\bin\libSFCGAL.dll
#1  0x000000006d30c93e in libSFCGAL!_ZN6SFCGAL7VersionEv () from C:\ming64gcc48\projects\postgresql\rel\pg9.4w64gcc48edb\bin\libSFCGAL.dll
#2  0x000000006d308601 in libSFCGAL!_ZN6SFCGAL7VersionEv () from C:\ming64gcc48\projects\postgresql\rel\pg9.4w64gcc48edb\bin\libSFCGAL.dll
#3  0x000000006d53a520 in libSFCGAL!_ZN6SFCGAL10LineString8addPointERKNS_5PointE () from C:\ming64gcc48\projects\postgresql\rel\pg9.4w64gcc48edb\bin\libSFCGAL.dll
#4  0x000000006d5395d9 in libSFCGAL!_ZN6SFCGAL10LineString8addPointERKNS_5PointE () from C:\ming64gcc48\projects\postgresql\rel\pg9.4w64gcc48edb\bin\libSFCGAL.dll
#5  0x000000006d53530c in libSFCGAL!_ZN6SFCGAL10LineString8addPointERKNS_5PointE () from C:\ming64gcc48\projects\postgresql\rel\pg9.4w64gcc48edb\bin\libSFCGAL.dll
#6  0x000000006d555c89 in libSFCGAL!_ZN6SFCGAL10LineString8addPointERKNS_5PointE () from C:\ming64gcc48\projects\postgresql\rel\pg9.4w64gcc48edb\bin\libSFCGAL.dll
#7  0x000000006d300118 in libSFCGAL!_ZN6SFCGAL11triangulate20triangulatePolygon3DERKNS_7PolygonERNS_19TriangulatedSurfaceE () from C:\ming64gcc48\projects\postgresql\rel\pg9.4w64gcc48edb\bin\libSFCGAL.dll
#8  0x000000006d2d4b6e in libSFCGAL!_ZN6SFCGAL6detaillsERSoRKNS0_11GeometrySetILi3EEE () from C:\ming64gcc48\projects\postgresql\rel\pg9.4w64gcc48edb\bin\libSFCGAL.dll
#9  0x000000006d505b01 in libSFCGAL!_ZN6SFCGAL10LineString8addPointERKNS_5PointE () from C:\ming64gcc48\projects\postgresql\rel\pg9.4w64gcc48edb\bin\libSFCGAL.dll
#10 0x000000006d506dfe in libSFCGAL!_ZN6SFCGAL10LineString8addPointERKNS_5PointE () from C:\ming64gcc48\projects\postgresql\rel\pg9.4w64gcc48edb\bin\libSFCGAL.dll
#11 0x000000006d25fa33 in libSFCGAL!_ZN6SFCGAL9algorithm12difference3DERKNS_8GeometryES3_NS0_15NoValidityCheckE () from C:\ming64gcc48\projects\postgresql\rel\pg9.4w64gcc48edb\bin\libSFCGAL.dll
#12 0x000000006d25fb3e in libSFCGAL!_ZN6SFCGAL9algorithm12difference3DERKNS_8GeometryES3_ () from C:\ming64gcc48\projects\postgresql\rel\pg9.4w64gcc48edb\bin\libSFCGAL.dll
#13 0x000000006d2be6e2 in sfcgal_geometry_difference_3d () from C:\ming64gcc48\projects\postgresql\rel\pg9.4w64gcc48edb\bin\libSFCGAL.dll
#14 0x000000007089260e in sfcgal_difference3D (fcinfo=0x3073a80) at lwgeom_sfcgal.c:563
#15 0x00000001401118e8 in postgres!ExecProject ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
Last edited 9 years ago by robe (previous) (diff)

comment:2 by robe, 9 years ago

Milestone: PostGIS 2.2.0PostGIS SFCGAL

comment:3 by hmercier, 6 years ago

Works as expected (returns an error) on a recent version:

POSTGIS="3.0.0dev r16844" [EXTENSION] PGSQL="100" GEOS="3.6.2-CAPI-1.10.2 4d2925d6" SFCGAL="1.3.5" PROJ="Rel. 5.1.0, June 1st, 2018" LIBXML="2.9.4" LIBJSON="0.12.1"

test_sfcgal=# SELECT ST_3DDifference('POINT(-11.1111111 40)'::geometry, 'POLYGON((1 2,1 2,1 2,1 2))'::geometry) As result;
NOTICE:  During difference_3d(A,B) :
NOTICE:    with A: POINT(-6254999476204023/562949953421312 40/1)
NOTICE:     and B: POLYGON((1/1 2/1,1/1 2/1,1/1 2/1,1/1 2/1))
ERREUR:  When converting to 3D - Polygon is invalid : ring 0 degenerated to a point : POLYGON((1/1 2/1 0/1,1/1 2/1 0/1,1/1 2/1 0/1,1/1 2/1 0/1))

comment:4 by strk, 6 years ago

Regina: can you add a regress test for this case, so it is secured ?

by hmercier, 6 years ago

Attachment: ticket_3255.patch.txt added

Patch to add a regression test for #3255

comment:5 by strk, 6 years ago

Resolution: fixed
Status: newclosed

In 16846:

Add test for crash in SFCGAL ST_3DDifference

Closes #3255

Note: See TracTickets for help on using tickets.