From 23170c828485a91146a156e2939687c4b479633c Mon Sep 17 00:00:00 2001 From: Peter Hillman Date: Mon, 7 Dec 2020 13:42:55 +1300 Subject: [PATCH] Merge ABI-compatible changes from #842 Signed-off-by: Peter Hillman --- OpenEXR/IlmImf/ImfDeepScanLineInputFile.cpp | 8 +++++--- OpenEXR/IlmImf/ImfInputFile.cpp | 2 +- OpenEXR/IlmImf/ImfTiledInputFile.cpp | 5 ++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/OpenEXR/IlmImf/ImfDeepScanLineInputFile.cpp b/OpenEXR/IlmImf/ImfDeepScanLineInputFile.cpp index 0844d23495..c094fa79cc 100644 --- a/OpenEXR/IlmImf/ImfDeepScanLineInputFile.cpp +++ b/OpenEXR/IlmImf/ImfDeepScanLineInputFile.cpp @@ -721,10 +721,12 @@ LineBufferTask::execute () int width = (_ifd->maxX - _ifd->minX + 1); + ptrdiff_t base = reinterpret_cast(&_ifd->sampleCount[0][0]); + base -= sizeof(unsigned int)*_ifd->minX; + base -= sizeof(unsigned int)*static_cast(_ifd->minY) * static_cast(width); + copyIntoDeepFrameBuffer (readPtr, slice.base, - (char*) (&_ifd->sampleCount[0][0] - - _ifd->minX - - _ifd->minY * width), + reinterpret_cast(base), sizeof(unsigned int) * 1, sizeof(unsigned int) * width, y, _ifd->minX, _ifd->maxX, diff --git a/OpenEXR/IlmImf/ImfInputFile.cpp b/OpenEXR/IlmImf/ImfInputFile.cpp index ea70ef4e4c..600c7023f6 100644 --- a/OpenEXR/IlmImf/ImfInputFile.cpp +++ b/OpenEXR/IlmImf/ImfInputFile.cpp @@ -281,7 +281,7 @@ bufferedReadPixels (InputFile::Data* ifd, int scanLine1, int scanLine2) // if no channels are being read that are present in file, cachedBuffer will be empty // - if (ifd->cachedBuffer->begin() != ifd->cachedBuffer->end()) + if (ifd->cachedBuffer && ifd->cachedBuffer->begin() != ifd->cachedBuffer->end()) { ifd->tFile->readTiles (0, ifd->tFile->numXTiles (0) - 1, j, j); } diff --git a/OpenEXR/IlmImf/ImfTiledInputFile.cpp b/OpenEXR/IlmImf/ImfTiledInputFile.cpp index 3e7fda333c..091ad623a3 100644 --- a/OpenEXR/IlmImf/ImfTiledInputFile.cpp +++ b/OpenEXR/IlmImf/ImfTiledInputFile.cpp @@ -958,7 +958,10 @@ TiledInputFile::initialize () { if (!isTiled (_data->version)) throw IEX_NAMESPACE::ArgExc ("Expected a tiled file but the file is not tiled."); - + + if (isNonImage (_data->version)) + throw IEX_NAMESPACE::ArgExc ("File is not a regular tiled image."); + } else {