[gdal-dev] Hints for debugging gdal vector drivers ?

Even Rouault even.rouault at spatialys.com
Wed May 20 09:11:24 PDT 2020


On mercredi 20 mai 2020 17:02:12 CEST Andrew C Aitchison wrote:
> I'm writing a gdal vector driver for a file-based data format.
> I'm getting a SIGSEGV in OGRLayer::GetExtentInternal called from
> ogrinfo code when I run
>     /usr/local/gdal3.1.0/bin/ogrinfo /home/maps/MemoryMap/Norway-1m.qct
> "outline" on my datafiles.
> 
> The stack trace below suggests that the feature has no valid extent (see
> m_sFilterEnvelope) - which is reasonable as the driver never sets a filter,
> envelope or extent.
> 
> I believe I've followed what was https://gdal.org/ogr_drivertut.html
> (IIRC http://manpages.org/ogr_drivertut is a reasonable mirror).
> How should the driver ensure that it gives OGR the necessary
> filter/envolope.extent information ?

>From the crash at line 267 of ogrlyaer.cpp, I'd say your driver returns a geometry object that 
has been destroyed

Random guess: you might do something like:
{
	OGRPoint p;
	poFeature->SetGeometryDirectly(&p);
	// p is destroy now, and poFeature has just kept the pointer on it.
}

==> Run Valgrind. Or run valgrind. Or perhaps run valgrind :-)

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200520/b13d9153/attachment.html>


More information about the gdal-dev mailing list