Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Apr 14, 2020
1 parent d76a061 commit ca88a11
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/spatialreference.cpp
Expand Up @@ -510,12 +510,16 @@ const GTIF* SpatialReference::GetGTIF()
#pragma pack(pop)

ShortKeyHeader *header = (ShortKeyHeader *)data.data();
// Calculate the number of shorts in the VLR data.
// The '+ 1' accounts for the header itself.
int count = (header->numKeys + 1) * 4;
short *data_s = reinterpret_cast<short *>( &(data[0]));

ST_SetKey(m_tiff, record.GetRecordId(), count, STT_SHORT, data_s);
if (header)
{
// Calculate the number of shorts in the VLR data.
// The '+ 1' accounts for the header itself.
int count = (header->numKeys + 1) * 4;
short *data_s = reinterpret_cast<short *>( &(data[0]));
if(std::size_t(count) <= data.size() / sizeof(short)) {
ST_SetKey(m_tiff, record.GetRecordId(), count, STT_SHORT, data_s);
}
}
}

if (uid == record.GetUserId(true).c_str() &&
Expand Down

0 comments on commit ca88a11

Please sign in to comment.