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

Writing 32k PNG results in invalid PNG #46

Open
CryptoCrocodile opened this issue Dec 10, 2016 · 1 comment
Open

Writing 32k PNG results in invalid PNG #46

CryptoCrocodile opened this issue Dec 10, 2016 · 1 comment

Comments

@CryptoCrocodile
Copy link

CryptoCrocodile commented Dec 10, 2016

I can't seem to be able to write 32k PNGs. Affinity Photo and Photoshop both seem to be able to write PNGs with up to 32767x32767 in both 8bit and 16bit modes so it seems to be supported by the spec. 16k PNGs seem to work.

EDIT: it's worth mentioning that writing a 30000x30000 greyscale+alpha texture seems to work.

@CryptoCrocodile CryptoCrocodile changed the title Writing 32k PNG Crash when writing 32k PNG Dec 11, 2016
@CryptoCrocodile CryptoCrocodile changed the title Crash when writing 32k PNG Writing 32k PNG results in invalid PNG Dec 11, 2016
@CryptoCrocodile
Copy link
Author

CryptoCrocodile commented Dec 11, 2016

FWIW, it doesn't seem to be related to the deflate/libz code, I've swapped it out with libz and it still produces invalid PNGs. Also it seems to be related to a narrowing cast to int, as an RGB 8bpp image of 27000x27000 produces an invalid image (2.187.000.000 bytes) but a 26700x26700 image is still valid (2.138.670.000 bytes) so the 27000^2 image seems to overflow a signed integer somewhere.

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

No branches or pull requests

1 participant