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

x/image/tiff: required tag ordering is not enforced #10549

Closed
osocurioso opened this issue Apr 22, 2015 · 6 comments
Closed

x/image/tiff: required tag ordering is not enforced #10549

osocurioso opened this issue Apr 22, 2015 · 6 comments

Comments

@osocurioso
Copy link
Contributor

Section 2 of the TIFF specification [1] says:

The entries in an IFD must be sorted in ascending order by Tag.

The data attached to #10393 is malformed according to this part of the spec:

bash$ tiffinfo 2fc6230e2f46d59145971374d691c4cff4efe373
TIFFReadDirectoryCheckOrder: Warning, Invalid TIFF directory; tags are not sorted in ascending order.
TIFFReadDirectory: Cannot handle zero scanline size.

The parser in x/image/tiff does not report this data as invalid.

[1] http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf

@nigeltao
Copy link
Contributor

CC @bsiegert.

@bsiegert
Copy link
Contributor

This was deliberate, according to the "be liberal in what you accept" rule; I was almost certain that there are broken tiff implementations that would end up generating unsorted IFDs ...

An argument could be made that if the IFD is not sorted, then the tiff would be broken in other ways as well. What do you think?

@nigeltao
Copy link
Contributor

I don't have much experience with TIFF, or have many of them lying around on my filesystem, but in general I'd start with doing what the spec says instead of being liberal. On the other hand, if there are real-world non-spec-compliant TIFF images out there, and libtiff accepts them, then I'm happy for TIFF in practice to trump TIFF in specification.

In either case, as I said, I don't have a lot of TIFF experience, so I'll defer the decision to @bsiegert.

@bsiegert
Copy link
Contributor

OK, let's change it. I'll send out a CL tomorrow.

chai2010 added a commit to chai2010/tiff that referenced this issue Apr 30, 2015
The spec says that these images are invalid.

Fixes golang/go#10549
@gopherbot
Copy link

CL https://golang.org/cl/9377 mentions this issue.

@chai2010
Copy link
Contributor

chai2010 commented Jun 8, 2015

Some real tiff file has unordered tags, i prefer not check the order.

@golang golang locked and limited conversation to collaborators Oct 4, 2017
mrhyperbit23z0d added a commit to mrhyperbit23z0d/bhegde8 that referenced this issue Jun 6, 2022
The spec says that these images are invalid. Add a test with an invalid
tiff generated by go-fuzz.

Fixes golang/go#10549

Change-Id: I3fd3ae5e607202b41735a2d930f55cb7997f7a9b
Reviewed-on: https://go-review.googlesource.com/9377
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
GalaxyForcew added a commit to GalaxyForcew/A1bisshy that referenced this issue Jun 6, 2022
The spec says that these images are invalid. Add a test with an invalid
tiff generated by go-fuzz.

Fixes golang/go#10549

Change-Id: I3fd3ae5e607202b41735a2d930f55cb7997f7a9b
Reviewed-on: https://go-review.googlesource.com/9377
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
yi-ge3 added a commit to yi-ge3/wislie that referenced this issue Jun 6, 2022
The spec says that these images are invalid. Add a test with an invalid
tiff generated by go-fuzz.

Fixes golang/go#10549

Change-Id: I3fd3ae5e607202b41735a2d930f55cb7997f7a9b
Reviewed-on: https://go-review.googlesource.com/9377
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
balloontmz6 added a commit to balloontmz6/Likewise42l that referenced this issue Jun 6, 2022
The spec says that these images are invalid. Add a test with an invalid
tiff generated by go-fuzz.

Fixes golang/go#10549

Change-Id: I3fd3ae5e607202b41735a2d930f55cb7997f7a9b
Reviewed-on: https://go-review.googlesource.com/9377
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
snapbakkhfbav added a commit to snapbakkhfbav/SayedBaladohr that referenced this issue Oct 6, 2022
The spec says that these images are invalid. Add a test with an invalid
tiff generated by go-fuzz.

Fixes golang/go#10549

Change-Id: I3fd3ae5e607202b41735a2d930f55cb7997f7a9b
Reviewed-on: https://go-review.googlesource.com/9377
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
MiderWong5ddop added a commit to MiderWong5ddop/sidie88f that referenced this issue Oct 7, 2022
The spec says that these images are invalid. Add a test with an invalid
tiff generated by go-fuzz.

Fixes golang/go#10549

Change-Id: I3fd3ae5e607202b41735a2d930f55cb7997f7a9b
Reviewed-on: https://go-review.googlesource.com/9377
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
rorypeckwnt4v added a commit to rorypeckwnt4v/LearnByBhanuPrataph that referenced this issue Oct 7, 2022
The spec says that these images are invalid. Add a test with an invalid
tiff generated by go-fuzz.

Fixes golang/go#10549

Change-Id: I3fd3ae5e607202b41735a2d930f55cb7997f7a9b
Reviewed-on: https://go-review.googlesource.com/9377
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
egorovcharenko9 added a commit to egorovcharenko9/RiceBIOC470z that referenced this issue Oct 7, 2022
The spec says that these images are invalid. Add a test with an invalid
tiff generated by go-fuzz.

Fixes golang/go#10549

Change-Id: I3fd3ae5e607202b41735a2d930f55cb7997f7a9b
Reviewed-on: https://go-review.googlesource.com/9377
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
RafayGhafoorf added a commit to RafayGhafoorf/dustinsand8 that referenced this issue Oct 7, 2022
The spec says that these images are invalid. Add a test with an invalid
tiff generated by go-fuzz.

Fixes golang/go#10549

Change-Id: I3fd3ae5e607202b41735a2d930f55cb7997f7a9b
Reviewed-on: https://go-review.googlesource.com/9377
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
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

6 participants