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

fix(exr): Avoid integer overflow for large deep exr slice strides #4542

Merged
merged 2 commits into from
Nov 30, 2024

Conversation

lgritz
Copy link
Collaborator

@lgritz lgritz commented Nov 25, 2024

Fixes #4540

@lgritz
Copy link
Collaborator Author

lgritz commented Nov 27, 2024

Original reporter of #4540 reported there that they applied this patch on their end and it fixes the problem.

@@ -1729,15 +1729,15 @@ OpenEXROutput::write_deep_scanlines(int ybegin, int yend, int /*z*/,
frameBuffer.insertSampleCountSlice(countslice);
std::vector<void*> pointerbuf;
dd->get_pointers(pointerbuf);
size_t slchans = size_t(m_spec.width) * size_t(nchans);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing that caused me to do a double-take in this PR is that this line doesn't mirror the form used in exrinput. Can we declare nchans as size_t above (assuming m_spec.nchannels is already known to be >= 0) so that this entire block of code will match what is used in exrinput? i.e. there's 3 casts to size_t in this block whereas the ones in exrinput has none.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that makes sense

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So updated (delay was for fixing the great GHA failure of 2024).

Fixes 4540

Signed-off-by: Larry Gritz <lg@larrygritz.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
@lgritz lgritz merged commit 9ee71c4 into AcademySoftwareFoundation:main Nov 30, 2024
28 checks passed
@lgritz lgritz deleted the lg-deepcrash branch November 30, 2024 06:19
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request Nov 30, 2024
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 this pull request may close these issues.

[BUG] Writing a very large deep EXR scanlines crashes
2 participants