Skip to content

[BUG] Divide by zero in iterator on EXR ImageBuf #3770

@rasmusbonnedal

Description

@rasmusbonnedal

Describe the bug
When creating an ImageBuf from an EXR and then using a non-const iterator on it I get division by zero. This issue appeared when we upgraded from v2.3.12.0 to v2.4.8.0

To Reproduce

  1. Create an ImageBuf from an exr file
  2. Create an ImageBuf::Iterator from the imagebuf
  3. I get exception integer division by zero

Expected behavior
Not divide by zero

Evidence
Code to reproduce:

OIIO::ImageBuf buf("testsuite\\oiiotool\\ref\\abs.exr");
OIIO::ImageBuf::Iterator<float> it(buf);

Error:

Unhandled exception at 0x00007FF8FF8FC22C (OpenImageIO_d.dll) in mtlx_baker-test.exe: 0xC0000094: Integer division by zero.
imagebuf.cpp:2856                     int xtile  = (x - m_spec.x) / tw;

Platform information:

  • OIIO 2.4.8.0
  • OS: Windows 11
  • C++ compiler: Visual Studio 2019
  • Any non-default build flags when you build OIIO:
            "OIIO_BUILD_TESTS": "0",
            "OIIO_DOWNLOAD_MISSING_TESTDATA": "0",
            "BUILD_DOCS": "0",
            "USE_PYTHON": "0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugCrash or wrong behavior of an existing feature.core APIsAffecting public APIs of core functionality classes, such as ImageInput, ImageOutput, ImageBuf.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions