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(psd): Prevent simultaneous psd thumbnail reads from clashing #3877

Merged
merged 1 commit into from
Jun 12, 2023

Conversation

lgritz
Copy link
Collaborator

@lgritz lgritz commented Jun 12, 2023

When reading a PSD file, if it contains a thumbnail, we read it from the in-memory blob with a combination of an IOMemReader and an ImageBuf. But... we always named it "thumbnail.jpg" without considering that multiple simultaneous PSD files reading identically named images (but which are in fact different) could cause a weird kind of clashing in any underlying use of ImageCache!

The simple fix is to use ordinary ImageInput approach to reading the thumbnail from the IOMemReader, but just store it in the ImageBuf.

Fixes #3824

When reading a PSD file, if it contains a thumbnail, we read it from
the in-memory blob with a combination of an IOMemReader and an
ImageBuf.  But... we always named it "thumbnail.jpg" without
considering that multiple simultaneous PSD files reading identically
named images (but which are in fact different) could cause a weird
kind of clashing in any underlying use of ImageCache!

The simple fix is to use ordinary ImageInput approach to reading the
thumbnail from the IOMemReader, but just store it in the ImageBuf.

Fixes 3824

Signed-off-by: Larry Gritz <[email protected]>
@lgritz
Copy link
Collaborator Author

lgritz commented Jun 12, 2023

@jessey-git are you able to try this proposed fix on your end and let us know if it appears to solve the problem?

@jessey-git
Copy link
Contributor

@lgritz Yes, I can confirm my small repro app works fine after the change here. I can't quite verify inside Blender itself as building the libraries there is giving me some issues. That said the fix seems sound by itself and I don't anticipate further problems as the stack traces I was seeing in user reports matches what the test app was hitting.

@lgritz lgritz merged commit 8da473e into AcademySoftwareFoundation:master Jun 12, 2023
@lgritz lgritz deleted the lg-psdthumb branch June 12, 2023 17:19
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request Jun 12, 2023
…demySoftwareFoundation#3877)

When reading a PSD file, if it contains a thumbnail, we read it from the
in-memory blob with a combination of an IOMemReader and an ImageBuf.
But... we always named it "thumbnail.jpg" without considering that
multiple simultaneous PSD files reading identically named images (but
which are in fact different) could cause a weird kind of clashing in any
underlying use of ImageCache!

The simple fix is to use ordinary ImageInput approach to reading the
thumbnail from the IOMemReader, but just store it in the ImageBuf.

Fixes AcademySoftwareFoundation#3824

Signed-off-by: Larry Gritz <[email protected]>
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] ASAN heap-use-after-free while concurrently opening PSD files
2 participants