-
Joe Tsai authored
The interfaces for io.Reader and io.Writer permit calling Read/Write with an empty buffer. However, this condition is often not well tested and can lead to bugs in various implementations of io.Reader and io.Writer. For example, see #22028 for buggy io.Reader in the bzip2 package. We reduce the likelihood of hitting these bugs by adjusting regFileReader.Read and regFileWriter.Write to avoid performing Read and Write calls when the buffer is known to be empty. Fixes #22029 Change-Id: Ie4a26be53cf87bc4d2abd951fa005db5871cc75c Reviewed-on: https://go-review.googlesource.com/66111 Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com> Reviewed-by: Giovanni Bajo <rasky@develer.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
7246585f