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 bugs, compiler warnings and add tests #32

Merged
merged 8 commits into from
Mar 28, 2019

Conversation

birktj
Copy link
Member

@birktj birktj commented Feb 28, 2019

This PR adds a Limits struct to fix the memory exhaustion bug in #29, this changes the public API slightly, because ifd::Entry::val now also needs a Limits parameter. It adds some array bounds checking for indices that directly come from the tiff file. While I was at it I also fixed #13 by changing Decoder::read_string to return a TiffResult instead of a FromUtf8Error result. I also fixed some smaller compiler and clippy warnings.

I added the samples from #28, #29 and #31 as new tests, thank you @Shnatsel!

This will fix #13, fix #28, fix #29, fix #30 and fix #31.

@Robzz and @HeroicKatora what do you think of this?

src/decoder/mod.rs Outdated Show resolved Hide resolved
@Shnatsel
Copy link

Thanks for fixing these so quickly! This has unblocked further fuzzing which found at least one more panic: #33

src/decoder/mod.rs Outdated Show resolved Hide resolved
@birktj
Copy link
Member Author

birktj commented Mar 12, 2019

@HeroicKatora I have fixed the possibly overflowing multiplication and changed the limits to usize. Do you think I need to change anything else or are we good to go?

@birktj
Copy link
Member Author

birktj commented Mar 27, 2019

@HeroicKatora @Robzz @bvssvni friendly ping. Would it be possible to look at this so that we can eventually release a new version of the library with the newly merged PRs?

@HeroicKatora
Copy link
Member

Just now realized that during converting to TiffResult, the line you changed here https://github.com/PistonDevelopers/image-tiff/pull/32/files#diff-ee033e65f37f7717cb17dc37bc71de6bL301 was actually a bug as the error was ignored. Good job 👍 We should probably do a stability release sometime soon. Want to merge this today if no further concerns appear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants