Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#4112 closed defect (fixed)

Seg Fault with SQL LEFT JOIN on shapefiles

Reported by: Daniel Morissette Owned by: Daniel Morissette
Priority: normal Milestone: 1.8.1
Component: OGR_SF Version: 1.8.0
Severity: normal Keywords:
Cc: warmerdam, Even Rouault

Description

I get a seg fault when doing a SQL LEFT JOIN on shapefiles, with OGRINFO 1.8.0 and trunk. I verified that v1.7.3 works fine, so this issue seems to have been introduced in v1.8.0.

It seems that any join will crash (I got reports from a user getting the crash with tab files), but just in case here is the command I use to reproduce it:

ogrinfo /path/to/popplace.shp -sql 'select * from popplace left join "/path/to/province.shp".province on popplace.name_e = province.name_e'

Change History (6)

comment:1 by Daniel Morissette, 13 years ago

Version: unspecified1.8.0

comment:2 by Daniel Morissette, 13 years ago

Status: newassigned

comment:3 by Daniel Morissette, 13 years ago

Backtrace with trunk... I'll rebuild with -g and try to look into this again later:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff77478fb in OGRGenSQLResultsLayer::AddFieldDefnToSet(int, int, _CPLHashSet*) ()
   from /opt/fgs3/fgs/lib/libgdal.so
(gdb) bt
#0  0x00007ffff77478fb in OGRGenSQLResultsLayer::AddFieldDefnToSet(int, int, _CPLHashSet*) ()
   from /opt/fgs3/fgs/lib/libgdal.so
#1  0x00007ffff7747b2c in OGRGenSQLResultsLayer::SetIgnoredFields() ()
   from /opt/fgs3/fgs/lib/libgdal.so
#2  0x00007ffff774487f in OGRGenSQLResultsLayer::OGRGenSQLResultsLayer(OGRDataSource*, void*, OGRGeometry*, char const*, char const*) () from /opt/fgs3/fgs/lib/libgdal.so
#3  0x00007ffff77011e8 in OGRDataSource::ExecuteSQL(char const*, OGRGeometry*, char const*) ()
   from /opt/fgs3/fgs/lib/libgdal.so
#4  0x00007ffff77f0839 in OGRShapeDataSource::ExecuteSQL(char const*, OGRGeometry*, char const*) ()
   from /opt/fgs3/fgs/lib/libgdal.so

comment:4 by Daniel Morissette, 13 years ago

Resolution: fixed
Status: assignedclosed

Fixed in SVN trunk r22518.

The order of args to AddFieldDefnToSet() was reversed in one place in SetIgnoredFields().

Should we backport this to the 1.8.x branch? (i.e. are we planning 1.8.x bugfix releases?)

comment:5 by warmerdam, 13 years ago

Component: defaultOGR_SF
Milestone: 1.8.1

I do plan one or more point releases against 1.8. I have backported this fix to 1.8 (r22519).

Thanks!

comment:6 by Even Rouault, 13 years ago

r22667 /trunk/autotest/ogr/ogr_join_test.py: Test fix for #4112 (join between 2 datasources)

Note: See TracTickets for help on using tickets.