Opened 7 years ago

Closed 7 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 7 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by pramsey, 7 years ago

Replicated here also :( Thanks for good reproduction case.

by pramsey, 7 years ago

Attachment: 3652.patch added

comment:2 by pramsey, 7 years ago

Resolution: fixed
Status: newclosed

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

comment:3 by robe, 7 years ago

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

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

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 by pramsey, 7 years ago

A good bug report deserves a good fix :)

comment:6 by robe, 7 years ago

Resolution: fixed
Status: closedreopened

comment:7 by robe, 7 years ago

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 by robe, 7 years ago

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 by robe, 7 years ago

Resolution: fixed
Status: reopenedclosed

false alarm

Note: See TracTickets for help on using tickets.