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 segfault #44

Merged
merged 2 commits into from
Dec 9, 2023
Merged

Fix segfault #44

merged 2 commits into from
Dec 9, 2023

Conversation

afichet
Copy link
Owner

@afichet afichet commented Dec 9, 2023

When the total memory required to store the whole image exceeds the upper int limit, in many places, there is memory violation #43.

This PR prevent this issue by performing an early check on the required memory size prior to allocation and access. Future revision shall handle such files by using larger types.

`m_width` and `m_height` are of `int` type in the OpenEXR library. We
currently keep the same types in our class but this may case issue
when mapping 1D memory. In the most favorable case, they are
multiplied together (Y framebuffer). For RGB(A) case, the required
memory can also be 4 time larger. We check if resp. `m_width *
m_height` and `4 * m_width * m_heigh` stay within the `int` higher
limit. Thanks to @GAP-dev for bringing this issue.

This commit also cleans a bit raw memory allocation in favor of
`std::vector` container.
@afichet afichet changed the base branch from master to v0.6.1 December 9, 2023 13:43
@afichet afichet merged commit fb9a0eb into v0.6.1 Dec 9, 2023
1 check passed
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.

None yet

1 participant