tiff: fixes problem with decoding tiled uint16 tiff files.

The proposed fix updates the x axis offset variable in case the tile
surpasses the limits of the destination image.

Fixes golang/go#24657

Change-Id: I6bc52274a05dc41b058f6a6f1d0a304f1b20152d
Reviewed-on: https://go-review.googlesource.com/104295
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
monkeybutter 2018-04-03 11:08:12 +10:00 committed by Brad Fitzpatrick
parent f3a9b89b59
commit f315e44030

View File

@ -264,6 +264,9 @@ func (d *decoder) decode(dst image.Image, xmin, ymin, xmax, ymax int) error {
}
img.SetGray16(x, y, color.Gray16{v})
}
if rMaxX == img.Bounds().Max.X {
d.off += 2 * (xmax - img.Bounds().Max.X)
}
}
} else {
img := dst.(*image.Gray)