Skip to content

Fix Deep Scanline Input crash when using a framebuffer as parameter #2019

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nikos-foundry
Copy link
Contributor

@nikos-foundry nikos-foundry commented Apr 11, 2025

The Deep Scanline Input code has recently been rewritten to make use of the EXR core library. As a result a bug was introduced when using the overloads of readPixels() and readPixelSampleCounts() that use externally provided framebuffers as parameters, a hard crash was occuring. According to the comment on the header of these functions, when these overloads are used the InputFile's frameBuffer is not used.
However both these functions call into readMemData(), which does use the InputFile's member framebuffer, which has not been allocated, resulting into a segmentation fault.
This commit fixes the above issue, by using the parameter framebuffer that is passed in, which should be allocated by the caller application.

Closes #2020

Copy link

linux-foundation-easycla bot commented Apr 11, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: nikos-foundry / name: Nikolaos Koutsikos (ff83af2, 7ca2ed0)

@lgritz
Copy link
Contributor

lgritz commented Apr 11, 2025

Does this reveal a hole in our testing? Is there a test that can be added to validate the fix? Does the same bug exist for deep tiled input?

@nikos-foundry
Copy link
Contributor Author

Does this reveal a hole in our testing? Is there a test that can be added to validate the fix? Does the same bug exist for deep tiled input?

Yes, there seems to be a hole in testing, since these overloaded functions are not being used in any of the existing tests. I will give it a go to add a case to one of the existing tests that uses these functions to extend our coverage.

I think that DeepTiledInput is not affected by this issue, since it seems to be using a different code path, and does not seem to use the problematic function (readMemData).

@nikos-foundry nikos-foundry force-pushed the foundry-fix-deep-scanline-input-crash branch from 58e6484 to 9720aab Compare April 14, 2025 16:41
…ebuffer

The Deep Scanline Input code has recently been rewritten to make use of the
EXR core library. As a result a bug was introduced when using the overloads of
readPixels() and readPixelSampleCounts() that use externally provided
framebuffers as parameters, a hard crash was occuring. According to the comment
on the header of these functions, when these overloads are used the InputFile's
frameBuffer is not used.
However both these functions call into readMemData(), which does use the
InputFile's member framebuffer, which has not been allocated, resulting into a
segmentation fault.
This commit fixes the above issue, by using the parameter framebuffer that is
passed in, which should be allocated by the caller application.

Signed-off-by: Nikolaos Koutsikos <[email protected]>
After having found a bug with the readPixels() and readPixelSampleCounts()
overloads that receive a framebuffer parameter, it was made apparent that there
was a hole in our tests to cover these functions.
This commits slightly refactors the DeepScanLineBasic tests and adds a third
read path to add coverage for this case as well.

Signed-off-by: Nikolaos Koutsikos <[email protected]>
@nikos-foundry nikos-foundry force-pushed the foundry-fix-deep-scanline-input-crash branch from 9720aab to 7ca2ed0 Compare April 30, 2025 09:15
Copy link
Contributor

@peterhillman peterhillman left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for the fix to the library and to the test.

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.

Deep Scanline Input readPixels() and readPixelCounts() crash when using an externally provided framebuffer
3 participants