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

Detect invalid PNG and prevent segfault #1324

Merged
merged 1 commit into from
Jan 11, 2019
Merged

Detect invalid PNG and prevent segfault #1324

merged 1 commit into from
Jan 11, 2019

Conversation

Hakerh400
Copy link
Contributor

IIUC, the cairo PNG parser reads data until the IEND chunk is reached. It doesn't perform any overrun checks, and if there is no IEND chunk, it will cause a segfault.

  • Have you updated CHANGELOG.md?

@zbjornson
Copy link
Collaborator

Good find. That seems like a pretty gross bug in cairo...

We also have #73 and #122 (and others?) open that AFAIK are unfixable without switching to libpng for loading images (instead of just writing). Any chance you're interested in doing that instead? Would be a cleaner fix...

@Hakerh400
Copy link
Contributor Author

Is this PR still relevant? None of the mentioned issues reproduce with Cairo 1.16.0.

@zbjornson
Copy link
Collaborator

Sorry for the delay. With cairo 1.16.0:

Glad you checked with newer Cairo 👍 . We could merge just the test from this PR if you want to drop the other changes.

@Hakerh400
Copy link
Contributor Author

Thanks for verifying. Left the test only.

@LinusU
Copy link
Collaborator

LinusU commented Jan 11, 2019

Nice!

@LinusU LinusU merged commit 1932d64 into Automattic:master Jan 11, 2019
@Hakerh400 Hakerh400 deleted the png-segfault branch January 11, 2019 22:26
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.

3 participants