Skip to content

Commit

Permalink
fix: sanitizer new warnings about signed/unsigned offsets in openexr (#…
Browse files Browse the repository at this point in the history
…4351)

Signed-off-by: Larry Gritz <[email protected]>
  • Loading branch information
lgritz committed Aug 1, 2024
1 parent a70ceb9 commit fe5e75d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/openexr.imageio/exrinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion src/openexr.imageio/exroutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit fe5e75d

Please sign in to comment.