#3377 closed defect (fixed)
Passing GeoJSON directly to ogrinfo causes a segfault
Reported by: | homme | Owned by: | Even Rouault |
---|---|---|---|
Priority: | normal | Milestone: | 1.7.1 |
Component: | OGR_SF | Version: | 1.7.0 |
Severity: | normal | Keywords: | |
Cc: |
Description
The page at http://www.gdal.org/ogr/drv_geojson.html states that a GeoJSON datasource can be "Text passed directly and encoded in GeoJSON". Trying this with the following two ogrinfo commands causes a segfault:
ogrinfo '{"type":"Feature","properties":{"foo":"bar"},"bbox":[-180.0,-90.0,180.0,90.0],"geometry":{"type":"Polygon","coordinates":[[[-180.0,10.0],[20.0,90.0],[180.0,-5.0],[-30.0,-90.0]]]}}' ERROR 4: GeoJSON Driver doesn't support update. Had to open data source read-only. INFO: Open of `{"type":"Feature","properties":{"foo":"bar"},"bbox":[-180.0,-90.0,180.0,90.0],"geometry":{"type":"Polygon","coordinates":[[[-180.0,10.0],[20.0,90.0],[180.0,-5.0],[-30.0,-90.0]]]}}' using driver `GeoJSON' successful. Segmentation fault
ogrinfo '{ "type": "Point", "coordinates": [100.0, 0.0] }' ERROR 4: GeoJSON Driver doesn't support update. Had to open data source read-only. INFO: Open of `{ "type": "Point", "coordinates": [100.0, 0.0] }' using driver `GeoJSON' successful. Segmentation fault
I am using GDAL 1.7.0, released 2010/01/19 on a Gentoo system (Linux peaches 2.6.31-gentoo-r6 #2 PREEMPT Tue Dec 22 13:26:44 GMT 2009 i686 AMD Athlon(tm) XP 2800+ AuthenticAMD GNU/Linux) compiled using gcc (Gentoo 4.3.4 p1.0, pie-10.1.5) 4.3.4.
I mention the two commands because they seem to produce different backtraces in gdb. The backtrace for the first is:
#0 0x4f2ccdd3 in *__GI___strcasecmp (s1=0x8051428 "{ \"type\": \"Point\", \"coordinates\": [100.0, 0.0] }", s2=0x0) at strcasecmp.c:65 loc = <value optimized out> result = <value optimized out> #1 0x0804a023 in main (nArgc=2, papszArgv=Cannot access memory at address 0x4 ) at ogrinfo.cpp:214 pszWHERE = 0x0 pszDataSource = 0x8051428 "{ \"type\": \"Point\", \"coordinates\": [100.0, 0.0] }" papszLayers = 0x0 poSpatialFilter = 0x0 nRepeatCount = 1 bAllLayers = 0 pszSQLStatement = 0x0 pszDialect = 0x0 poDS = 0x80518c0 poDriver = 0x80514c0
and for the second is:
#0 0x41e23d7a in OGRGeoJSONReader::GenerateFeatureDefn (this=<value optimized out>, poObj=<value optimized out>) at ogrgeojsonreader.cpp:402 poDefn = 0x80522a8 bSuccess = <value optimized out> poObjProps = <value optimized out> #1 0x41e23f39 in OGRGeoJSONReader::GenerateLayerDefn (this=<value optimized out>) at ogrgeojsonreader.cpp:319 bSuccess = true objType = <value optimized out> poLayerDefn = <value optimized out> #2 0x41e24adc in OGRGeoJSONReader::ReadLayer (this=<value optimized out>, pszName=<value optimized out>, poDS=<value optimized out>) at ogrgeojsonreader.cpp:116 objType = <value optimized out> poSRS = <value optimized out> #3 0x41e20fec in OGRGeoJSONDataSource::LoadLayer (this=<value optimized out>) at ogrgeojsondatasource.cpp:492 err = <value optimized out> poLayer = <value optimized out> reader = Could not find the frame base for "OGRGeoJSONDataSource::LoadLayer()".
Change History (3)
comment:1 by , 14 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
follow-up: 3 comment:2 by , 14 years ago
Milestone: | → 1.7.1 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Not sure why you got 2 different stack traces. The issue is the same.
Fixed in trunk (r18720) and in branches/1.7 (r18721). Tested in r18722.