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 parsing slices #17

Merged
merged 1 commit into from
Apr 23, 2020
Merged

Fix parsing slices #17

merged 1 commit into from
Apr 23, 2020

Conversation

chinedufn
Copy link
Owner

@chinedufn chinedufn commented Apr 21, 2020

This PR fixes an issue where my files that weren't even using psd slices started panicking as of 0.1.16.

I'm not too familiar with slices - so it's possible that they can be automatically created in some cases. I don't know.

This PR adds a test case where I create a 1x1 white pixel PSD file and it panics when parsing the name of a group of slices. I did not add any slices to this file.

The crash appears to only happen when the name of the PSD (without them stem) is a certain length. So a fifteen character name such as fiteen-letters.psd crashes, a 23 character name crashes, but other lengths don't.

This PR also removes the individual descriptor file tests in favor of testing against real PSD files. I was finding that while trying to debug those files weren't helping me because there was no way to know whether or not they were correct and how to reason about the data within them.

@chinedufn chinedufn requested a review from tdakkota April 21, 2020 04:16
// Would be great to find a better solution for this
//
// @see tests/slices_resource.rs
if number_of_slices == 65536 {
Copy link
Owner Author

Choose a reason for hiding this comment

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

I just have no idea .. But once I add this both the test file as well as the file in my real project work.

My only guess is that [0, 1, 0, 0] for the number of slices means something.

@chinedufn chinedufn merged commit 7ca124c into master Apr 23, 2020
@chinedufn chinedufn deleted the fix/slices branch April 23, 2020 12:45
tdakkota added a commit to tdakkota/psd that referenced this pull request Apr 23, 2020
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