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>
diff --git a/tiff/reader.go b/tiff/reader.go
index 0e3d332..8a941c1 100644
--- a/tiff/reader.go
+++ b/tiff/reader.go
@@ -264,6 +264,9 @@
 					}
 					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)