Opened 5 years ago

Closed 5 years ago

#6152 closed defect (fixed)

ogr2ogr crashes with CSV containing empty (NULL) geometry

Reported by: rtorre Owned by: Even Rouault
Priority: normal Milestone: 2.1.0
Component: OGR_SF Version: svn-trunk
Severity: normal Keywords: ogr2ogr, csv_drv, GEOM_POSSIBLE_NAMES
Cc: Even Rouault

Description

ogr2ogr crashes when trying to import a csv using the GEOM_POSSIBLE_NAMES option when the referenced column contains empty (NULL) values:

$ ogr2ogr \
  -f PostgreSQL PG:"host=localhost port=5432 user=postgres dbname=tests" \
  -oo GEOM_POSSIBLE_NAMES=the_geom \
  -oo KEEP_GEOM_COLUMNS=NO \
  bug_empty_the_geom.csv

ERROR 1: Invalid index : 3
Segmentation fault (core dumped)

Interestingly it does not crash if:

  • KEEP_GEOM_COLUMNS=NO is not used or set to YES, or
  • the_geom has non-null values in all rows.

Attachments (1)

bug_empty_the_geom.csv (56 bytes) - added by rtorre 5 years ago.

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by rtorre

Attachment: bug_empty_the_geom.csv added

comment:1 Changed 5 years ago by Even Rouault

Owner: changed from warmerdam to Even Rouault

comment:2 Changed 5 years ago by Even Rouault

Resolution: fixed
Status: newclosed
Version: unspecifiedsvn-trunk

trunk r31006 "CSV: fix crash with empty geometry column and GEOM_POSSIBLE_NAMES and KEEP_GEOM_COLUMNS=NO options (#6152)"

Pushed in 2.0_cartodb branch in https://github.com/rouault/gdal2/commit/ad3285765895989215875aaaa124b9e8f57f0aa2

Note: See TracTickets for help on using tickets.