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

image/png: reading an image with binary transparency returns wrong error #4278

Closed
gopherbot opened this issue Oct 23, 2012 · 9 comments
Closed

Comments

@gopherbot
Copy link

by jsummers3456:

Using png.Decode to read a PNG image with binary transparency gives a bogus "chunk
out of order".

Test case: http://play.golang.org/p/d6ojL0cDZL

Expected output:
A "png: unsupported feature: ..." error (or no error).

Actual output:
"png: invalid format: chunk out of order"

Compiler: 6g
OS: Linux
Version: devel +8d919bfe75d3 Tue Oct 23 02:33:51 2012 +0800
@griesemer
Copy link
Contributor

Comment 1:

Owner changed to @nigeltao.

@nigeltao
Copy link
Contributor

nigeltao commented Nov 5, 2012

Comment 2:

That play.golang.org program gives the raw bytes; can you describe how that test image
was generated?

@gopherbot
Copy link
Author

Comment 3 by jsummers3456:

I don't know, I think I modified one of my programs that uses libpng, then used
<https://github.com/jteeuwen/go-bindata>;. The goal was to make a minimal testcase
for this bug.
Any non-paletted image with a tRNS chunk will do. There are examples in PngSuite
<http://www.schaik.com/pngsuite/PngSuite-2011apr25.tgz>;, such as tbrn2c08.png.

@gopherbot
Copy link
Author

Comment 4 by Vova616:

Looks like it makes problems after trying to read "gAMA" chunk which isn't supported yet.

@rsc
Copy link
Contributor

rsc commented Dec 10, 2012

Comment 5:

Labels changed: added size-m.

@rsc
Copy link
Contributor

rsc commented Dec 10, 2012

Comment 6:

Labels changed: added suggested.

@rsc
Copy link
Contributor

rsc commented Dec 30, 2012

Comment 7:

Labels changed: added priority-later, removed priority-triage.

Status changed to Accepted.

@vdobler
Copy link
Contributor

vdobler commented Feb 18, 2013

Comment 8:

The provided sample image is not a valid PNG image.
The mentioned tbrn2c08.png of
http://www.schaik.com/pngsuite/PngSuite-2011apr25.tgz
is also invalid.
The spec is pretty clear about tRNS has to come after PLTE and
before IDAT.  See:
http://www.libpng.org/pub/png/spec/iso/index-object.html#5ChunkOrdering
It seems as if this was not check in libpng prior to 1.6.0
but is enforced now.
See
http://sourceforge.net/p/libpng/code/ci/0da9cf38cd55178e6dabacf720fa21741bc50cd5/tree/pngrutil.c#l1001
So: Not a bug.

@nigeltao
Copy link
Contributor

Comment 9:

Labels changed: removed go1.1, size-m, suggested.

Status changed to WorkingAsIntended.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants