Opened 4 years ago

Closed 4 years ago

#3652 closed defect (fixed)

Segmentation fault during operations on GEOMETRYCOLLECTION with MULTICURVE geometry inside

Reported by: Alexey Gladkov Owned by: pramsey
Priority: high Milestone: PostGIS 2.2.3
Component: postgis Version: 2.2.x


Some geometry processing operations (ST_IsValid, ST_Intersects, etc.) failed with segmentation fault while processing GEOMETRYCOLLECTION with MULTICURVE geometry inside.

For example:

select ST_IsValid(
        CIRCULARSTRING(4509840.66032566 6159495.07789317,4509840.83573805 6159495.0756582,4509840.66032566 6159495.07789317),
        CIRCULARSTRING(4509810.5758974 6159485.61206918,4509810.75130944 6159485.60983459,4509810.5758974 6159485.61206918),
        CIRCULARSTRING(4508718.97328402 6158861.90032518,4508719.14867204 6158861.89810483,4508718.97328402 6158861.90032518),
        CIRCULARSTRING(4508700.47664928 6157887.92238478,4508700.65199856 6157887.92016489,4508700.47664928 6157887.92238478),
        CIRCULARSTRING(4508620.48140204 6156731.46399378,4508620.65670539 6156731.4617752,4508620.48140204 6156731.46399378),
        CIRCULARSTRING(4508125.75656021 6155769.74506917,4508125.93182571 6155769.7428572,4508125.75656021 6155769.74506917),
        CIRCULARSTRING(4506850.79644217 6154971.65577768,4506850.9716769 6154971.65358234,4506850.79644217 6154971.65577768)))'::geometry

The case was tested on two versions:

  • "POSTGIS="2.2.2 r14797" GEOS="3.5.0-CAPI-1.9.0 r4084" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.4, released 2016/01/25" LIBXML="2.9.1" LIBJSON="0.11" TOPOLOGY RASTER" "PostgreSQL 9.5.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4), 64-bit"
  • "POSTGIS="2.3.0 r15146" GEOS="3.5.0-CAPI-1.9.0 r4090" PROJ="Rel. 4.9.1, 04 March 2015" GDAL="GDAL 2.1.1, released 2016/07/07" LIBXML="2.7.8" LIBJSON="0.12" TOPOLOGY RASTER"

It not the case, but also some side-effect occured in geoserver when share such geometries. Geoserver also failed with message like:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ServiceExceptionReport version="1.1.1">
<ServiceException code="internalError">Rendering process failed Invalid number of points in LinearRing (found 3 - must be 0 or >= 4)</ServiceException>

Attachments (1)

3652.patch (467 bytes) - added by pramsey 4 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 4 years ago by pramsey

Replicated here also :( Thanks for good reproduction case.

Changed 4 years ago by pramsey

Attachment: 3652.patch added

comment:2 Changed 4 years ago by pramsey

Resolution: fixed
Status: newclosed

Patched in 2.2 at r15167, 2.3 at r15168 and trunk at r15169

comment:3 Changed 4 years ago by robe

Milestone: PostGIS 2.3.1PostGIS 2.2.3
Version: 2.3.x2.2.x

comment:4 in reply to:  2 Changed 4 years ago by Alexey Gladkov

Replying to pramsey:

Patched in 2.2 at r15167, 2.3 at r15168 and trunk at r15169

Thanks a lot for so fast fixing!

comment:5 Changed 4 years ago by pramsey

A good bug report deserves a good fix :)

comment:6 Changed 4 years ago by robe

Resolution: fixed
Status: closedreopened

comment:7 Changed 4 years ago by robe

I thought it was just sfcgal tests failing, but on closer inspection, getting failure on my local PostgreSQL 9.5 run for these tests under my windows desktop.

What's really bugging me is that winnie actually passed the 9.5 64-bit on this commit and yet we are supposed to be setup more or less the same.

I'm rerunning on debbie, she crashed on 9.5, but didn't show a regress on her 9.6 run.

On spot check on failing tests,

the in_encodedpolyline test shows this

-linefromencodedpolyline_02|SRID=4326;LINESTRING(-120.234 38.5,-120.95 40.734,-126.453 43.252)
+linefromencodedpolyline_02|SRID=4326;LINESTRING(-1202.345 385,-1209.5 407.344,-1264.53 432.52)

comment:8 Changed 4 years ago by robe

This might actually be a false alarm. I'll close once I've confirmed. I think it might be my make install is not working so I'm not testing the right version.

comment:9 Changed 4 years ago by robe

Resolution: fixed
Status: reopenedclosed

false alarm

Note: See TracTickets for help on using tickets.