Skip to content

Commit db217f2

Browse files
authored
DeepScanlineInputFile now uses chunk size test from DeepTiledInputFile (#1205)
Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
1 parent 4d070f7 commit db217f2

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

Diff for: src/lib/OpenEXR/ImfDeepScanLineInputFile.cpp

+12-6
Original file line numberDiff line numberDiff line change
@@ -1961,14 +1961,20 @@ readSampleCountForLineBlock(InputStreamMutex* streamData,
19611961
// @TODO refactor the compressor code to ensure full 64-bit support.
19621962
//
19631963

1964-
int compressorMaxDataSize = std::numeric_limits<int>::max();
1965-
if (sampleCountTableDataSize > uint64_t(compressorMaxDataSize))
1964+
uint64_t compressorMaxDataSize = static_cast<uint64_t>(std::numeric_limits<int>::max());
1965+
if (packedDataSize > compressorMaxDataSize ||
1966+
unpackedDataSize > compressorMaxDataSize ||
1967+
sampleCountTableDataSize > compressorMaxDataSize)
19661968
{
1967-
THROW (IEX_NAMESPACE::ArgExc, "This version of the library does not "
1968-
<< "support the allocation of data with size > "
1969-
<< compressorMaxDataSize
1970-
<< " file table size :" << sampleCountTableDataSize << ".\n");
1969+
THROW (IEX_NAMESPACE::ArgExc, "This version of the library does not"
1970+
<< "support the allocation of data with size > "
1971+
<< compressorMaxDataSize
1972+
<< " file table size :" << sampleCountTableDataSize
1973+
<< " file unpacked size :" << unpackedDataSize
1974+
<< " file packed size :" << packedDataSize << ".\n");
19711975
}
1976+
1977+
19721978
streamData->is->read(data->sampleCountTableBuffer, static_cast<int>(sampleCountTableDataSize));
19731979

19741980
const char* readPtr;

0 commit comments

Comments
 (0)