Skip to content
Permalink
Browse files Browse the repository at this point in the history
DeepScanlineInputFile now uses chunk size test from DeepTiledInputFile (
#1205)

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
  • Loading branch information
peterhillman committed Nov 18, 2021
1 parent 4d070f7 commit db217f2
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/lib/OpenEXR/ImfDeepScanLineInputFile.cpp
Expand Up @@ -1961,14 +1961,20 @@ readSampleCountForLineBlock(InputStreamMutex* streamData,
// @TODO refactor the compressor code to ensure full 64-bit support.
//

int compressorMaxDataSize = std::numeric_limits<int>::max();
if (sampleCountTableDataSize > uint64_t(compressorMaxDataSize))
uint64_t compressorMaxDataSize = static_cast<uint64_t>(std::numeric_limits<int>::max());
if (packedDataSize > compressorMaxDataSize ||
unpackedDataSize > compressorMaxDataSize ||
sampleCountTableDataSize > compressorMaxDataSize)
{
THROW (IEX_NAMESPACE::ArgExc, "This version of the library does not "
<< "support the allocation of data with size > "
<< compressorMaxDataSize
<< " file table size :" << sampleCountTableDataSize << ".\n");
THROW (IEX_NAMESPACE::ArgExc, "This version of the library does not"
<< "support the allocation of data with size > "
<< compressorMaxDataSize
<< " file table size :" << sampleCountTableDataSize
<< " file unpacked size :" << unpackedDataSize
<< " file packed size :" << packedDataSize << ".\n");
}


streamData->is->read(data->sampleCountTableBuffer, static_cast<int>(sampleCountTableDataSize));

const char* readPtr;
Expand Down

0 comments on commit db217f2

Please sign in to comment.