Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Writing a very large deep EXR scanlines crashes #4540

Open
dleex opened this issue Nov 22, 2024 · 5 comments · May be fixed by #4542
Open

[BUG] Writing a very large deep EXR scanlines crashes #4540

dleex opened this issue Nov 22, 2024 · 5 comments · May be fixed by #4542

Comments

@dleex
Copy link

dleex commented Nov 22, 2024

Describe the bug

Writing a large deep scanline EXR crashes.

OpenImageIO version and dependencies

OIIO 2.5.17.0 | Linux/x86_64
Build compiler: gcc 11.4 | C++17/201703
HW features enabled at build: sse2
Dependencies: , Boost 1.74.0, BZip2 NONE, DCMTK NONE, FFmpeg NONE, Freetype 2.11.1, GIF NONE, JPEG 80, Libheif
NONE, libjpeg-turbo NONE, LibRaw NONE, OpenColorIO NONE, OpenCV NONE, OpenEXR 3.3.2, OpenGL, OpenJPEG NONE, PNG
1.6.37, Ptex NONE, Ptex NONE, pybind11 2.9.1, Python 3.10.12, Qt5 NONE, Qt6 NONE, Robinmap, TBB NONE, TIFF 4.3.0,
WebP NONE, ZLIB 1.2.11

It was also reproducible in older version: OIIO 2.3.14 using OpenEXR 3.2 and also 2.2.18.

To Reproduce

Steps to reproduce the behavior:

  1. Extract the attached python script
  2. Run (eg 'python3 dcmbug.py')
  3. Wait until it crashes

dcmbug.zip

The exact same crash can be observed when doing the same via C++ API also. If you reduce the image resolution significantly (or reduce the number of channels significantly) then it no longer crashes.
I'm reasonably certain it's OIIO-related issue and not OpenEXR because the similar test in OpenEXR does not crash.

@lgritz
Copy link
Collaborator

lgritz commented Nov 22, 2024

I can reproduce the crash using OIIO 3.0. I'll try to take a look over the weekend.

Incidentally, oiio.TypeDesc.TypeHalf and those types have been deprecated for many years and were finally removed in 3.0, so your python script will start giving you errors starting with 3.0. The easy fix is to use oiio.TypeHalf (those things moved to the overall namespace, not within TypeDesc), but also you may find it even simpler just to use strings, like this:

test_chantypes += ('half', 'half', 'half')

or

spec = oiio.ImageSpec (test_xres, test_yres, test_nchannels, 'float')

anyplace in the OIIO python bindings that a TypeDesc is expected, a string is just fine, too, and it will construct a TypeDesc from it.

@lgritz
Copy link
Collaborator

lgritz commented Nov 23, 2024

I don't suppose you could also post the C++ code that crashes?

@lgritz
Copy link
Collaborator

lgritz commented Nov 23, 2024

Wait, never mind, I think I recreated the equivalent myself.

@lgritz
Copy link
Collaborator

lgritz commented Nov 24, 2024

Found it, it's an integer overflow issue.

Testing a fix.

@dleex
Copy link
Author

dleex commented Nov 27, 2024

We tested the fix on our end as well and so far so good!
Thank you for the very prompt response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants