From 35e09934f4fea45a325fcb478e710fa5f58eece8 Mon Sep 17 00:00:00 2001 From: Kimball Thurston Date: Sat, 28 Sep 2024 11:23:46 +1200 Subject: [PATCH] Use 64-bit values for the pointer math Other reader classes already use 64-bit numbers for pointer math, fix this case to use the same Signed-off-by: Kimball Thurston --- src/lib/OpenEXR/ImfInputFile.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lib/OpenEXR/ImfInputFile.cpp b/src/lib/OpenEXR/ImfInputFile.cpp index 7dedf2327..f643ea920 100644 --- a/src/lib/OpenEXR/ImfInputFile.cpp +++ b/src/lib/OpenEXR/ImfInputFile.cpp @@ -579,16 +579,16 @@ InputFile::Data::copyCachedBuffer (FrameBuffer::ConstIterator to, const char* fromPtr = fromSlice.base; if (toSlice.yTileCoords) - toPtr += (y - yStart) * toSlice.yStride; + toPtr += ( int64_t (y) - int64_t (yStart) ) * toSlice.yStride; else - toPtr += y * toSlice.yStride; + toPtr += int64_t (y) * toSlice.yStride; if (!toSlice.xTileCoords) - toPtr += xStart * toSlice.xStride; + toPtr += int64_t (xStart) * toSlice.xStride; - fromPtr += (y - yStart) * fromSlice.yStride; + fromPtr += ( int64_t (y) - int64_t (yStart) ) * fromSlice.yStride; if (fromSlice.xStride == 2) { - fromPtr += xStart * 2; + fromPtr += int64_t (xStart) * 2; for (int x = 0; x < width; ++x) { *reinterpret_cast (toPtr) = @@ -599,7 +599,7 @@ InputFile::Data::copyCachedBuffer (FrameBuffer::ConstIterator to, } else { - fromPtr += xStart * 4; + fromPtr += int64_t (xStart) * 4; for (int x = 0; x < width; ++x) { *reinterpret_cast (toPtr) = @@ -627,11 +627,11 @@ InputFile::Data::fillBuffer (FrameBuffer::ConstIterator to, char* toPtr = toSlice.base; if (toSlice.yTileCoords) - toPtr += (y - yStart) * toSlice.yStride; + toPtr += ( int64_t (y) - int64_t (yStart) ) * toSlice.yStride; else - toPtr += y * toSlice.yStride; + toPtr += int64_t (y) * toSlice.yStride; if (!toSlice.xTileCoords) - toPtr += xStart * toSlice.xStride; + toPtr += int64_t (xStart) * toSlice.xStride; // // Copy all pixels for the scanline in this row of tiles