Skip to content
Permalink
Browse files

GTiff: make sure that GetMetadataDomainList() doesn't return EXIF whe…

…n there's no EXIF metadata (fixes mapbox/rasterio#1740 (comment))
  • Loading branch information...
rouault committed Sep 10, 2019
1 parent bd215c2 commit d4013be8565b3d2e774ef1432e0d57877e40c676
Showing with 17 additions and 2 deletions.
  1. +12 −0 autotest/gcore/tiff_read.py
  2. +5 −2 gdal/frmts/gtiff/geotiff.cpp
@@ -3401,3 +3401,15 @@ def method(request):

gdal.GetDriverByName('GTIFF').Delete(in_filename)
gdal.GetDriverByName('GTIFF').Delete(cog_filename)

###############################################################################
# Check that GetMetadataDomainList() works properly


def test_tiff_GetMetadataDomainList():

ds = gdal.Open('data/byte.tif')
mdd1_set = set([x for x in ds.GetMetadataDomainList()])
assert mdd1_set == set(['', 'DERIVED_SUBDATASETS', 'IMAGE_STRUCTURE'])
mdd2_set = set([x for x in ds.GetMetadataDomainList()])
assert mdd1_set == mdd2_set
@@ -19003,8 +19003,11 @@ void GTiffDataset::LoadEXIFMetadata()
nExifOffset, nInterOffset, nGPSOffset );
}

m_oGTiffMDMD.SetMetadata( papszMetadata, "EXIF" );
CSLDestroy( papszMetadata );
if( papszMetadata )
{
m_oGTiffMDMD.SetMetadata( papszMetadata, "EXIF" );
CSLDestroy( papszMetadata );
}
}

/************************************************************************/

0 comments on commit d4013be

Please sign in to comment.
You can’t perform that action at this time.