diff --git a/src/openexr.imageio/exrinput.cpp b/src/openexr.imageio/exrinput.cpp index 3c9933c7bc..39c097ebb2 100644 --- a/src/openexr.imageio/exrinput.cpp +++ b/src/openexr.imageio/exrinput.cpp @@ -1139,7 +1139,8 @@ OpenEXRInput::read_native_scanlines(int subimage, int miplevel, int ybegin, const PartInfo& part(m_parts[m_subimage]); size_t pixelbytes = m_spec.pixel_bytes(chbegin, chend, true); size_t scanlinebytes = (size_t)m_spec.width * pixelbytes; - char* buf = (char*)data - m_spec.x * pixelbytes - ybegin * scanlinebytes; + char* buf = (char*)data - m_spec.x * stride_t(pixelbytes) + - ybegin * stride_t(scanlinebytes); try { if (part.luminance_chroma) { diff --git a/src/openexr.imageio/exroutput.cpp b/src/openexr.imageio/exroutput.cpp index 93894c17d9..f4138cc64a 100644 --- a/src/openexr.imageio/exroutput.cpp +++ b/src/openexr.imageio/exroutput.cpp @@ -1516,7 +1516,8 @@ OpenEXROutput::write_scanlines(int ybegin, int yend, int z, TypeDesc format, // the bytes to be written, but OpenEXR's frameBuffer.insert() wants // where the address of the "virtual framebuffer" for the whole // image. - char* buf = (char*)d - m_spec.x * pixel_bytes - y * scanlinebytes; + char* buf = (char*)d - m_spec.x * stride_t(pixel_bytes) + - y * stride_t(scanlinebytes); try { Imf::FrameBuffer frameBuffer; size_t chanoffset = 0;