Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#6267 closed defect (fixed)

Crash when loading postgis raster

Reported by: mkuhn Owned by: warmerdam
Priority: normal Milestone: 1.11.5
Component: GDAL_Raster Version: 2.0.1
Severity: normal Keywords:
Cc:

Description

I created a simple raster table in postgis using the instructions from on top of the manual http://postgis.net/docs/manual-2.1/RT_reference.html

When loading it in QGIS via GDAL I got a crash.

The segfault is caused by a nullptr in postgisrasterdataset.cpp:821. On prb (null pointer) GetNoDataValue is called, iBand is 0, nBandsToCreate is 3 (so I guess it's the second demo data row which is inserted).

Not sure if the cause is that SRID is 0 in the exmple.

More info:

in GDALRasterBand * GDALDataset::GetRasterBand( int nBandId ), gdaldataset.cpp:691

the check

if ( papoBands )

fails

0	PostGISRasterDataset::AddComplexSource	postgisrasterdataset.cpp	821	0x7fffefb61eb8	
1	PostGISRasterDataset::ConstructOneDatasetFromTiles	postgisrasterdataset.cpp	1834	0x7fffefb63770	
2	PostGISRasterDataset::SetRasterProperties	postgisrasterdataset.cpp	2432	0x7fffefb6419d	
3	PostGISRasterDataset::Open	postgisrasterdataset.cpp	2931	0x7fffefb649a3	
4	GDALOpenEx	gdaldataset.cpp	2570	0x7fffefc074c7	
5	QgsGdalProviderBase::gdalOpen	qgsgdalproviderbase.cpp	250	0x7fff6647d78b	
6	QgsGdalProvider::QgsGdalProvider	qgsgdalprovider.cpp	154	0x7fff6647f99d	
7	classFactory	qgsgdalprovider.cpp	1912	0x7fff6648cab4	
8	QgsProviderRegistry::provider	qgsproviderregistry.cpp	383	0x7ffff544f2a6	
9	QgsRasterLayer::setDataProvider	qgsrasterlayer.cpp	654	0x7ffff5643277	
10	QgsRasterLayer::QgsRasterLayer	qgsrasterlayer.cpp	136	0x7ffff564560a	
11	QgisApp::addRasterLayerPrivate	qgisapp.cpp	9912	0x7ffff74a9aad	
12	QgisApp::addRasterLayer	qgisapp.cpp	9999	0x7ffff7470148	
13	QgisApp::dropEvent	qgisapp.cpp	1199	0x7ffff746eb55	
14	QWidget::event	qwidget.cpp	8775	0x7ffff3ca2140	
15	QMainWindow::event	qmainwindow.cpp	1478	0x7ffff4082393	
16	QgisApp::event	qgisapp.cpp	1231	0x7ffff7470274	
17	QApplicationPrivate::notify_helper	qapplication.cpp	4565	0x7ffff3c4b93c	
18	QApplication::notify	qapplication.cpp	4351	0x7ffff3c53890	
19	QgsApplication::notify	qgsapplication.cpp	269	0x7ffff51f79f4	
...	<More>				

Change History (6)

comment:1 by meier, 8 years ago

I don't quite follow what you're doing. Loading the raster table (the one mentioned in the example and others) from a database seem to work fine for me. Can you provide any other information?

comment:2 by Even Rouault, 8 years ago

Resolution: fixed
Status: newclosed

In 34434:

PostgisRaster: fix potential crash when one tile has a lower number of bands than the max of the table (fixes #6267)

comment:3 by Even Rouault, 8 years ago

In 34435:

PostgisRaster: fix potential crash when one tile has a lower number of bands than the max of the table (fixes #6267)

comment:4 by Even Rouault, 8 years ago

In 34436:

PostgisRaster: fix potential crash when one tile has a lower number of bands than the max of the table (fixes #6267)

comment:5 by Even Rouault, 8 years ago

In 34437:

PostgisRaster: fix potential crash when one tile has a lower number of bands than the max of the table (fixes #6267)

comment:6 by Even Rouault, 8 years ago

Milestone: 1.11.5
Note: See TracTickets for help on using tickets.