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: handle empty channel data #42

Merged
merged 1 commit into from
Jul 28, 2022
Merged

Conversation

pastelmind
Copy link
Collaborator

@pastelmind pastelmind commented Jul 28, 2022

Some layers (e.g. gradient fill layers) may have empty channel data. Previously, attempting to skip over the scan lines in such channels resulted in buffer overflow (RangeError).

Let's avoid this by limiting the skip amount to the size of the channel data. This ensures that empty channels cannot be "skipped" at all.

Note: This appears to render the layer as a 1x1 empty image. Although this is not ideal, we can't do anything about it. Synthesizing a layer image from its gradient metadata is currently beyond our scope.

Fixes #40

Some layers (e.g. gradient fill layers) may have empty channel data.
Previously, attempting to skip over the scan lines in such channels
resulted in buffer overflow (RangeError).
Let's avoid this by limiting the skip amount to the size of the channel
data. This ensures that empty channels cannot be "skipped" at all.

Note: This appears to render the layer as a 1x1 empty image.
Although this is not ideal, we can't do anything about it. Synthesizing
a layer image from its gradient metadata is currently beyond our scope.
@pastelmind pastelmind added the type: bug Something isn't working label Jul 28, 2022
@pastelmind pastelmind self-assigned this Jul 28, 2022
@pastelmind pastelmind merged commit 9cd2d8f into main Jul 28, 2022
@pastelmind pastelmind deleted the fix-handle-empty-channel-data branch July 28, 2022 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Opening a PSD file throws "invalid typed array length" error
1 participant