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

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

gopherbot opened this issue Oct 23, 2012 · 9 comments

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Oct 23, 2012

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

@griesemer griesemer commented Nov 1, 2012

Comment 1:

Owner changed to @nigeltao.

@nigeltao
Copy link
Contributor

@nigeltao 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

@gopherbot gopherbot commented Nov 6, 2012

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

@gopherbot gopherbot commented Nov 22, 2012

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 rsc commented Dec 10, 2012

Comment 5:

Labels changed: added size-m.

@rsc
Copy link
Contributor

@rsc rsc commented Dec 10, 2012

Comment 6:

Labels changed: added suggested.

@rsc
Copy link
Contributor

@rsc rsc commented Dec 30, 2012

Comment 7:

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

Status changed to Accepted.

@vdobler
Copy link
Contributor

@vdobler 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

@nigeltao nigeltao commented Feb 19, 2013

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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.