Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
io: prevent seeking to position prior to offsetwrite.base
We don't want to permit writing before the start of an OffsetWriter. One of the goals of OffsetWriter is to restrict where data can be written. However, this rule can be violated by WriteAt() method of OffsetWriter as the following code shows: f, _ := os.Create("file.txt") owr := io.NewOffsetWriter(f, 10) owr.Write([]byte("world")) owr.WriteAt([]byte("hello"), -10) Change-Id: I6c7519fea68daefa641f25130cdd9803dc8aae22 GitHub-Last-Rev: a29d890d6f32fd5a1ecef84d012b8447b406e2e2 GitHub-Pull-Request: golang/go#60222 Reviewed-on: https://go-review.googlesource.com/c/go/+/495155 Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Jabar Asadi <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
- Loading branch information