Opened 10 years ago

Closed 10 years ago

#3384 closed defect (fixed)

ogr2ogr crashes when converting SHP to MIF in version 1.70

Reported by: rhodges Owned by: chaitanya
Priority: high Milestone: 1.7.1
Component: OGR_SF Version: 1.7.0
Severity: blocker Keywords: mitab
Cc: Daniel Morissette, warmerdam, aboudreault

Description

You should have no problem reproducing this, as the problem is a null pointer dereference on the return value of GetLayerDefn?() from a newly created MIF layer. It appears that the MIF driver behaves differently than others in that it doesn't create this layer definition until you first start modifying it; unfortunately the new ogr2ogr code assumes that it will have done. I will attach a diff showing one way to defend against this, but perhaps you would prefer the approach of modifying the MIF driver instead -- I don't have enough familiarity with the code to feel confident attacking it from that angle.

Attachments (1)

ogr_diff.txt (2.7 KB) - added by rhodges 10 years ago.
Diff showing one possible fix for this crash

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by rhodges

Attachment: ogr_diff.txt added

Diff showing one possible fix for this crash

comment:1 Changed 10 years ago by warmerdam

Cc: Daniel Morissette warmerdam added
Component: defaultOGR_SF
Keywords: mitab added
Owner: changed from warmerdam to chaitanya

Chaitanya,

Could you look into this? You will need to cooperate with Daniel on changes that need to go upstream into mitab.

comment:2 Changed 10 years ago by Daniel Morissette

Cc: aboudreault added

comment:3 Changed 10 years ago by Even Rouault

Milestone: 1.7.1
Resolution: fixed
Status: newclosed

rhodges,

I've applied your patch in trunk (r18749) and in branches/1.7 (r18750) as a quick regression fix for it to go in time for 1.7.1. Tests added in r18751. Thanks !

Chaitanya,

I've opened ticket #3391 to track the fact that the MapInfo? driver doesn't behave like other drivers.

Note: See TracTickets for help on using tickets.