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: grayscale tiled images are not decoded correctly #36121

Open
zerkms opened this issue Dec 13, 2019 · 5 comments
Open

x/image/tiff: grayscale tiled images are not decoded correctly #36121

zerkms opened this issue Dec 13, 2019 · 5 comments
Labels
Milestone

Comments

@zerkms
Copy link

@zerkms zerkms commented Dec 13, 2019

What version of Go are you using (go version)?

$ go version
go version go1.13.4 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ivan/.cache/go-build"
GOENV="/home/ivan/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/srv/work/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/ivan/.local/share/umake/go/go-lang"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/ivan/.local/share/umake/go/go-lang/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/srv/work/go/src/go.googlesource.com/image/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build974283161=/tmp/go-build -gno-record-gcc-switches"

What did you do?

When you decode tiled tiff grayscale image you may find that tiles placed on the image boundary (right) are decoded incorrectly.

It happens because the tiff file contains the complete tile compressed, while the loop iterates only over the part of it that fits the image boundary:

			for y := ymin; y < rMaxY; y++ {
				for x := xmin; x < rMaxX; x++ {

So if you read pixels from the non-complete tiles (from the right edge) all lines but the first one would contain real data mixed with garbage (bits from outside the image boundary).

What did you expect to see?

What did you see instead?

@gopherbot gopherbot added this to the Unreleased milestone Dec 13, 2019
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Dec 13, 2019

Change https://golang.org/cl/211237 mentions this issue: go.image/tiff: fix for decoding grayscale tiled images

@toothrot

This comment has been minimized.

Copy link
Contributor

@toothrot toothrot commented Dec 13, 2019

/cc @nigeltao

@nigeltao

This comment has been minimized.

Copy link
Contributor

@nigeltao nigeltao commented Dec 14, 2019

/cc @bsiegert

@zerkms

This comment has been minimized.

Copy link
Author

@zerkms zerkms commented Jan 16, 2020

Hey team, any chance this to be dragged forward any time soon? It's a pretty significant bug, yet with a simple fix.

@nigeltao

This comment has been minimized.

Copy link
Contributor

@nigeltao nigeltao commented Jan 19, 2020

I dropped some review comments on https://go-review.googlesource.com/c/image/+/211237

Sorry for the late reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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