Opened 7 years ago

Closed 7 years ago

#2216 closed defect (fixed)

ST_GeomFromGeoJson MultiPolygon crash

Reported by: halset Owned by: strk
Priority: blocker Milestone: PostGIS 2.0.3
Component: postgis Version: 2.0.x
Keywords: history Cc: mateusz@…

Description

I am having trouble parsing a MultiPolygon? GeoJSON.

Some googling lead me to http://trac.osgeo.org/postgis/ticket/2130, so I upgraded from 2.0.1 to 2.0.2. At least, I think I did. I installed postgis and did a "ALTER EXTENSION postgis UPDATE TO '2.0.2';" in my database. The query in #2130 does work in my database.

The sql that crashes in my database are attached.

postgis_full_version() returns POSTGIS="2.0.2 r10789" GEOS="3.3.5-CAPI-1.7.5" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.9.2, released 2012/10/08" LIBXML="2.7.8" LIBJSON="UNKNOWN" RASTER

This is with json-c 0.9. I have tried with json-c 0.10 as well, but it still says LIBJSON="UNKNOWN" and crashes.

This is on a mac, but I have the same problem on ubuntu linux

Attachments (2)

geojson-multipolygon-crash.sql.txt (5.1 KB) - added by halset 7 years ago.
2216-20.patch (6.0 KB) - added by halset 7 years ago.
patch for 2.0-branch. works for me.

Download all attachments as: .zip

Change History (7)

Changed 7 years ago by halset

comment:1 Changed 7 years ago by strk

Owner: changed from pramsey to strk
Priority: mediumblocker
Status: newassigned

Confirmed with POSTGIS="2.0.3SVN r10972" and POSTGIS="2.1.0SVN r10973"

comment:2 Changed 7 years ago by mloskot

Cc: mateusz@… added

Changed 7 years ago by halset

Attachment: 2216-20.patch added

patch for 2.0-branch. works for me.

comment:3 Changed 7 years ago by strk

r11119 moves the code to liblwgeom (and fixes a leak). Will look at your patch right now.

comment:4 Changed 7 years ago by strk

Found a simpler case:

{"type":"MultiPolygon","coordinates":[[[[4,0],[0,-4],[-4,0],[0,4],[4,0]],[[2,0],[0,2],[-2,0],[0,-2],[2,0]]],[[[24,0],[20,-4],[16,0],[20,4],[24,0]],[[22,0],[20,2],[18,0],[20,-2],[22,0]]],[[[44,0],[40,-4],[36,0],[40,4],[44,0]],[[42,0],[40,2],[38,0],[40,-2],[42,0]]]]}

comment:5 Changed 7 years ago by strk

Keywords: history added
Resolution: fixed
Status: assignedclosed

r11120 adds the new testcase in liblwgeom cunit and applies your patch (thanks!) in trunk, r11121 adds the test to regress/ r11122 puts all to 2.0 branch.

Note: See TracTickets for help on using tickets.