[Gdal-dev] crash ( access violation ) in GDAL when trying to read a TIFF

Stephane Routelous route at cae.com
Wed Sep 1 11:26:24 EDT 2004


I'm using gdal1.2.1 on Windows.
When I'm reading a tif file (for example the cramps-tile.tif file from the
libtiff test images), I got a crash on windows (VisualC++ 6.0) using
If I run the test in debug without Boundchecker or in release without
boundchecker, it works fine.

The code is simply :
	GDALDataset* m_gdalDataSet = (GDALDataset *) GDALOpen(
"C:\\TestDB\\cramps-tile.tif", GA_ReadOnly ); //crash here

the error is reported to occur in tif_dirinfo.c line 292 :
static int
tagCompare(const void* a, const void* b)
	const TIFFFieldInfo* ta = *(const TIFFFieldInfo**) a;
	const TIFFFieldInfo* tb = *(const TIFFFieldInfo**) b;
	/* NB: be careful of return values for 16-bit platforms */
	if (ta->field_tag != tb->field_tag)
//crash here
		return (ta->field_tag < tb->field_tag ? -1 : 1);
		return ((int)tb->field_type - (int)ta->field_type);

According to the debugger, ta is not valid (0xfbfbfbfb) but a is valid.
When I tried to make the cast in the debug window, I got (which seems to be
invalid) :
-	*(const TIFFFieldInfo**) a	{...}
	field_tag	4227595259
	field_readcount	-20968
	field_writecount	4134
	field_type	270970412
	field_bit	64764
	field_oktochange	252 'ü'
	field_passcount	252 'ü'
+	field_name	0x003601a9



Can you help me with this problem ?

Thanks a lot in advance,


More information about the Gdal-dev mailing list