Opened 18 years ago
Last modified 18 years ago
#1059 closed defect (fixed)
ogr2ogr: segfaults on MapInfo tab
Reported by: | Owned by: | Daniel Morissette | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | OGR_SF | Version: | unspecified |
Severity: | major | Keywords: | |
Cc: |
Description
Frank, The I have following problems with MapInfo files: $ ogr2ogr -f "MapInfo File" -s_srs epsg:2180 -t_srs epsg:32633 drogi_utm33.tab Drogi.tab ERROR 7: TABPolyline: Geometry must contain at least 2 points. Segmentation fault $ ogr2ogr -f "MapInfo File" drogi_utm33.tab Drogi.tab ERROR 7: TABPolyline: Geometry must contain at least 2 points. *** glibc detected *** free(): invalid pointer: 0x080aa300 *** Aborted The Drogi.tab and friends are available here for download (1.5 MB): http://www.biol.uni.wroc.pl/sieczka/udostepnione/gdal/Drogi.tar.bz2 This is only an example. I have about 20 more with the same problems. I'm in serious trouble. I also don't know how to trasnform them into shapefiles: $ ogr2ogr -s_srs epsg:2180 -t_srs epsg:32633 drogi_utm33.tab Drogi.tab ERROR 1: Attempt to write non-linestring (POINT) geometry to ARC type shapefile. ERROR 1: Terminating translation prematurely after failed translation of layer Drogi Using GDAL 1.3.1 CVS 2006-01-09. Maciek
Change History (3)
comment:2 by , 18 years ago
Based on the description it seems that your data would contain LINE or PLINE objects with only 1 vertex which is invalid. The TAB driver should not crash in that case, I'll have to fix that. However the error you get from the shapefile driver is normal (that's what you'll get from the TAB driver once it's fixed) and the error can be skipped if you pass -skipfailures to ogr2ogr. Trying to replicate and fix the TAB driver crash now.
comment:3 by , 18 years ago
Fixed in MITAB master and in GDAL/OGR in CVS. The problem was happening inside TABFile::SetFeature(), the call to ValidateMapInfoType() was failing due to the invalid geometry and returning type TAB_GEOM_NONE and later on TABPolyline::WriteGeometryToMapFile() was receiving a TABMapObjHdr of type TAB_GEOM_NONE but wasn't expecting that. I have added a few checks to handle this case in mitab_feature.cpp r1.63 and mitab_tabfile.cpp r1.59
Note:
See TracTickets
for help on using tickets.