Opened 13 years ago

Closed 13 years ago

#1434 closed defect (fixed)

ST_GeomFromGeoJSON - Malformed GeoJSON causes SIGSEGV in postgres process?

Reported by: tokumine Owned by: pramsey
Priority: medium Milestone: PostGIS 2.0.0
Component: postgis Version: master
Keywords: geojson Cc:

Description

Hi all,

I am really enjoying the new ST_GeomFromGeoJSON functionality in PostGIS2.0SVN.

However, if I try to create geometry with certain types of invalid GeoJSON I have managed to trigger a SIGSEGV in the postgres process that causes cascading rollbacks and restarts to all other existing postgres processes.

Works:

select ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [100.0, 0.0] }');

Throws 'ERROR: invalid GeoJson representation' as expected:

select ST_GeomFromGeoJSON('{ "type": "Poooooooooooooint", "coordinates": [100.0, 0.0] }');

Causes SIGSEGV:

select ST_GeomFromGeoJSON('{ "type": "Point", "crashme": [100.0, 0.0] }');
select ST_GeomFromGeoJSON('crashme');

I can trigger this on my Ubuntu and OSX dev machines and attach the OSX crashlog and the Ubuntu postgres logs for reference.

Please note that occasionally the SQL commands will need to be run a few times to trigger the SIGSEGV.

All the best,

Simon

Attachments (2)

geojson_sigsegv_osx.txt (17.3 KB ) - added by tokumine 13 years ago.
geojson_segfault_ubuntu.txt (2.8 KB ) - added by tokumine 13 years ago.

Download all attachments as: .zip

Change History (3)

by tokumine, 13 years ago

Attachment: geojson_sigsegv_osx.txt added

by tokumine, 13 years ago

Attachment: geojson_segfault_ubuntu.txt added

comment:1 by pramsey, 13 years ago

Resolution: fixed
Status: newclosed

Needed some more guards in the code. Fixed at r8690

Note: See TracTickets for help on using tickets.